Fossil SCM

Further progress towards jerusalem on yet another holy docco crusade!

martin.weber 2011-09-15 00:54 msw-docco merge
Commit 17f21f2482dea2aa87841db580aa3321041e9839
+1 -3
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478478
**
479479
** This command does NOT rename or move the files on disk. This command merely
480480
** records the fact that filenames have changed so that appropriate notations
481481
** can be made at the next commit/checkin.
482482
**
483
-**
484
-** SUMMARY: fossil mv|rename OLDNAME NEWNAME
485
-** or: fossil mv|rename OLDNAME... DIR
483
+** See also: changes, status
486484
*/
487485
void mv_cmd(void){
488486
int i;
489487
int vid;
490488
char *zDest;
491489
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478 **
479 ** This command does NOT rename or move the files on disk. This command merely
480 ** records the fact that filenames have changed so that appropriate notations
481 ** can be made at the next commit/checkin.
482 **
483 **
484 ** SUMMARY: fossil mv|rename OLDNAME NEWNAME
485 ** or: fossil mv|rename OLDNAME... DIR
486 */
487 void mv_cmd(void){
488 int i;
489 int vid;
490 char *zDest;
491
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478 **
479 ** This command does NOT rename or move the files on disk. This command merely
480 ** records the fact that filenames have changed so that appropriate notations
481 ** can be made at the next commit/checkin.
482 **
483 ** See also: changes, status
 
 
484 */
485 void mv_cmd(void){
486 int i;
487 int vid;
488 char *zDest;
489
+1 -3
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478478
**
479479
** This command does NOT rename or move the files on disk. This command merely
480480
** records the fact that filenames have changed so that appropriate notations
481481
** can be made at the next commit/checkin.
482482
**
483
-**
484
-** SUMMARY: fossil mv|rename OLDNAME NEWNAME
485
-** or: fossil mv|rename OLDNAME... DIR
483
+** See also: changes, status
486484
*/
487485
void mv_cmd(void){
488486
int i;
489487
int vid;
490488
char *zDest;
491489
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478 **
479 ** This command does NOT rename or move the files on disk. This command merely
480 ** records the fact that filenames have changed so that appropriate notations
481 ** can be made at the next commit/checkin.
482 **
483 **
484 ** SUMMARY: fossil mv|rename OLDNAME NEWNAME
485 ** or: fossil mv|rename OLDNAME... DIR
486 */
487 void mv_cmd(void){
488 int i;
489 int vid;
490 char *zDest;
491
--- src/add.c
+++ src/add.c
@@ -478,13 +478,11 @@
478 **
479 ** This command does NOT rename or move the files on disk. This command merely
480 ** records the fact that filenames have changed so that appropriate notations
481 ** can be made at the next commit/checkin.
482 **
483 ** See also: changes, status
 
 
484 */
485 void mv_cmd(void){
486 int i;
487 int vid;
488 char *zDest;
489
+10 -10
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
4646
"SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
4747
" FROM attachment",
4848
-1
4949
);
5050
if( zPage ){
51
- if( g.okRdWiki==0 ) login_needed();
51
+ if( g.perm.RdWiki==0 ) login_needed();
5252
style_header("Attachments To %h", zPage);
5353
blob_appendf(&sql, " WHERE target=%Q", zPage);
5454
}else if( zTkt ){
55
- if( g.okRdTkt==0 ) login_needed();
55
+ if( g.perm.RdTkt==0 ) login_needed();
5656
style_header("Attachments To Ticket %.10s", zTkt);
5757
blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
5858
}else{
59
- if( g.okRdTkt==0 && g.okRdWiki==0 ) login_needed();
59
+ if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ) login_needed();
6060
style_header("All Attachments");
6161
}
6262
blob_appendf(&sql, " ORDER BY mtime DESC");
6363
db_prepare(&q, "%s", blob_str(&sql));
6464
while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139139
140140
if( zPage && zTkt ) zTkt = 0;
141141
if( zFile==0 ) fossil_redirect_home();
142142
login_check_credentials();
143143
if( zPage ){
144
- if( g.okRdWiki==0 ) login_needed();
144
+ if( g.perm.RdWiki==0 ) login_needed();
145145
zTarget = zPage;
146146
}else if( zTkt ){
147
- if( g.okRdTkt==0 ) login_needed();
147
+ if( g.perm.RdTkt==0 ) login_needed();
148148
zTarget = zTkt;
149149
}else{
150150
fossil_redirect_home();
151151
}
152152
if( attachid>0 ){
@@ -172,11 +172,11 @@
172172
style_header("Missing");
173173
@ Attachment has been deleted
174174
style_footer();
175175
return;
176176
}
177
- g.okRead = 1;
177
+ g.perm.Read = 1;
178178
cgi_replace_parameter("name",zUUID);
179179
if( fossil_strcmp(g.zPath,"attachview")==0 ){
180180
artifact_page();
181181
}else{
182182
cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207207
if( P("cancel") ) cgi_redirect(zFrom);
208208
if( zPage && zTkt ) fossil_redirect_home();
209209
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210210
login_check_credentials();
211211
if( zPage ){
212
- if( g.okApndWiki==0 || g.okAttach==0 ) login_needed();
212
+ if( g.perm.ApndWiki==0 || g.perm.Attach==0 ) login_needed();
213213
if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214214
fossil_redirect_home();
215215
}
216216
zTarget = zPage;
217217
zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218218
g.zTop, zPage, zPage);
219219
}else{
220
- if( g.okApndTkt==0 || g.okAttach==0 ) login_needed();
220
+ if( g.perm.ApndTkt==0 || g.perm.Attach==0 ) login_needed();
221221
if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222222
zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223223
" WHERE tagname GLOB 'tkt-%q*'", zTkt);
224224
if( zTkt==0 ) fossil_redirect_home();
225225
}
@@ -313,14 +313,14 @@
313313
if( zPage && zTkt ) fossil_redirect_home();
314314
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315315
if( zFile==0 ) fossil_redirect_home();
316316
login_check_credentials();
317317
if( zPage ){
318
- if( g.okWrWiki==0 || g.okAttach==0 ) login_needed();
318
+ if( g.perm.WrWiki==0 || g.perm.Attach==0 ) login_needed();
319319
zTarget = zPage;
320320
}else{
321
- if( g.okWrTkt==0 || g.okAttach==0 ) login_needed();
321
+ if( g.perm.WrTkt==0 || g.perm.Attach==0 ) login_needed();
322322
zTarget = zTkt;
323323
}
324324
if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325325
if( P("cancel") ){
326326
cgi_redirect(zFrom);
327327
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
46 "SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
47 " FROM attachment",
48 -1
49 );
50 if( zPage ){
51 if( g.okRdWiki==0 ) login_needed();
52 style_header("Attachments To %h", zPage);
53 blob_appendf(&sql, " WHERE target=%Q", zPage);
54 }else if( zTkt ){
55 if( g.okRdTkt==0 ) login_needed();
56 style_header("Attachments To Ticket %.10s", zTkt);
57 blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
58 }else{
59 if( g.okRdTkt==0 && g.okRdWiki==0 ) login_needed();
60 style_header("All Attachments");
61 }
62 blob_appendf(&sql, " ORDER BY mtime DESC");
63 db_prepare(&q, "%s", blob_str(&sql));
64 while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139
140 if( zPage && zTkt ) zTkt = 0;
141 if( zFile==0 ) fossil_redirect_home();
142 login_check_credentials();
143 if( zPage ){
144 if( g.okRdWiki==0 ) login_needed();
145 zTarget = zPage;
146 }else if( zTkt ){
147 if( g.okRdTkt==0 ) login_needed();
148 zTarget = zTkt;
149 }else{
150 fossil_redirect_home();
151 }
152 if( attachid>0 ){
@@ -172,11 +172,11 @@
172 style_header("Missing");
173 @ Attachment has been deleted
174 style_footer();
175 return;
176 }
177 g.okRead = 1;
178 cgi_replace_parameter("name",zUUID);
179 if( fossil_strcmp(g.zPath,"attachview")==0 ){
180 artifact_page();
181 }else{
182 cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207 if( P("cancel") ) cgi_redirect(zFrom);
208 if( zPage && zTkt ) fossil_redirect_home();
209 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210 login_check_credentials();
211 if( zPage ){
212 if( g.okApndWiki==0 || g.okAttach==0 ) login_needed();
213 if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214 fossil_redirect_home();
215 }
216 zTarget = zPage;
217 zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218 g.zTop, zPage, zPage);
219 }else{
220 if( g.okApndTkt==0 || g.okAttach==0 ) login_needed();
221 if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
224 if( zTkt==0 ) fossil_redirect_home();
225 }
@@ -313,14 +313,14 @@
313 if( zPage && zTkt ) fossil_redirect_home();
314 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315 if( zFile==0 ) fossil_redirect_home();
316 login_check_credentials();
317 if( zPage ){
318 if( g.okWrWiki==0 || g.okAttach==0 ) login_needed();
319 zTarget = zPage;
320 }else{
321 if( g.okWrTkt==0 || g.okAttach==0 ) login_needed();
322 zTarget = zTkt;
323 }
324 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325 if( P("cancel") ){
326 cgi_redirect(zFrom);
327
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
46 "SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
47 " FROM attachment",
48 -1
49 );
50 if( zPage ){
51 if( g.perm.RdWiki==0 ) login_needed();
52 style_header("Attachments To %h", zPage);
53 blob_appendf(&sql, " WHERE target=%Q", zPage);
54 }else if( zTkt ){
55 if( g.perm.RdTkt==0 ) login_needed();
56 style_header("Attachments To Ticket %.10s", zTkt);
57 blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
58 }else{
59 if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ) login_needed();
60 style_header("All Attachments");
61 }
62 blob_appendf(&sql, " ORDER BY mtime DESC");
63 db_prepare(&q, "%s", blob_str(&sql));
64 while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139
140 if( zPage && zTkt ) zTkt = 0;
141 if( zFile==0 ) fossil_redirect_home();
142 login_check_credentials();
143 if( zPage ){
144 if( g.perm.RdWiki==0 ) login_needed();
145 zTarget = zPage;
146 }else if( zTkt ){
147 if( g.perm.RdTkt==0 ) login_needed();
148 zTarget = zTkt;
149 }else{
150 fossil_redirect_home();
151 }
152 if( attachid>0 ){
@@ -172,11 +172,11 @@
172 style_header("Missing");
173 @ Attachment has been deleted
174 style_footer();
175 return;
176 }
177 g.perm.Read = 1;
178 cgi_replace_parameter("name",zUUID);
179 if( fossil_strcmp(g.zPath,"attachview")==0 ){
180 artifact_page();
181 }else{
182 cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207 if( P("cancel") ) cgi_redirect(zFrom);
208 if( zPage && zTkt ) fossil_redirect_home();
209 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210 login_check_credentials();
211 if( zPage ){
212 if( g.perm.ApndWiki==0 || g.perm.Attach==0 ) login_needed();
213 if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214 fossil_redirect_home();
215 }
216 zTarget = zPage;
217 zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218 g.zTop, zPage, zPage);
219 }else{
220 if( g.perm.ApndTkt==0 || g.perm.Attach==0 ) login_needed();
221 if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
224 if( zTkt==0 ) fossil_redirect_home();
225 }
@@ -313,14 +313,14 @@
313 if( zPage && zTkt ) fossil_redirect_home();
314 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315 if( zFile==0 ) fossil_redirect_home();
316 login_check_credentials();
317 if( zPage ){
318 if( g.perm.WrWiki==0 || g.perm.Attach==0 ) login_needed();
319 zTarget = zPage;
320 }else{
321 if( g.perm.WrTkt==0 || g.perm.Attach==0 ) login_needed();
322 zTarget = zTkt;
323 }
324 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325 if( P("cancel") ){
326 cgi_redirect(zFrom);
327
+4 -4
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286286
int showClosed = P("closed")!=0;
287287
int showAll = P("all")!=0;
288288
int colorTest = P("colortest")!=0;
289289
290290
login_check_credentials();
291
- if( !g.okRead ){ login_needed(); return; }
291
+ if( !g.perm.Read ){ login_needed(); return; }
292292
if( colorTest ){
293293
showClosed = 0;
294294
showAll = 1;
295295
}
296296
@@ -348,11 +348,11 @@
348348
}
349349
if( colorTest ){
350350
const char *zColor = hash_color(zBr);
351351
@ <li><span style="background-color: %s(zColor)">
352352
@ %h(zBr) &rarr; %s(zColor)</span></li>
353
- }else if( g.okHistory ){
353
+ }else if( g.perm.History ){
354354
@ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355355
}else{
356356
@ <li><b>%h(zBr)</b></li>
357357
}
358358
}
@@ -374,11 +374,11 @@
374374
** the timeline of a "brlist" page. Add some additional hyperlinks
375375
** to the end of the line.
376376
*/
377377
static void brtimeline_extra(int rid){
378378
Stmt q;
379
- if( !g.okHistory ) return;
379
+ if( !g.perm.History ) return;
380380
db_prepare(&q,
381381
"SELECT substr(tagname,5) FROM tagxref, tag"
382382
" WHERE tagxref.rid=%d"
383383
" AND tagxref.tagid=tag.tagid"
384384
" AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399399
*/
400400
void brtimeline_page(void){
401401
Stmt q;
402402
403403
login_check_credentials();
404
- if( !g.okRead ){ login_needed(); return; }
404
+ if( !g.perm.Read ){ login_needed(); return; }
405405
406406
style_header("Branches");
407407
style_submenu_element("List", "List", "brlist");
408408
login_anonymous_available();
409409
@ <h2>The initial check-in for each branch:</h2>
410410
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286 int showClosed = P("closed")!=0;
287 int showAll = P("all")!=0;
288 int colorTest = P("colortest")!=0;
289
290 login_check_credentials();
291 if( !g.okRead ){ login_needed(); return; }
292 if( colorTest ){
293 showClosed = 0;
294 showAll = 1;
295 }
296
@@ -348,11 +348,11 @@
348 }
349 if( colorTest ){
350 const char *zColor = hash_color(zBr);
351 @ <li><span style="background-color: %s(zColor)">
352 @ %h(zBr) &rarr; %s(zColor)</span></li>
353 }else if( g.okHistory ){
354 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355 }else{
356 @ <li><b>%h(zBr)</b></li>
357 }
358 }
@@ -374,11 +374,11 @@
374 ** the timeline of a "brlist" page. Add some additional hyperlinks
375 ** to the end of the line.
376 */
377 static void brtimeline_extra(int rid){
378 Stmt q;
379 if( !g.okHistory ) return;
380 db_prepare(&q,
381 "SELECT substr(tagname,5) FROM tagxref, tag"
382 " WHERE tagxref.rid=%d"
383 " AND tagxref.tagid=tag.tagid"
384 " AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399 */
400 void brtimeline_page(void){
401 Stmt q;
402
403 login_check_credentials();
404 if( !g.okRead ){ login_needed(); return; }
405
406 style_header("Branches");
407 style_submenu_element("List", "List", "brlist");
408 login_anonymous_available();
409 @ <h2>The initial check-in for each branch:</h2>
410
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286 int showClosed = P("closed")!=0;
287 int showAll = P("all")!=0;
288 int colorTest = P("colortest")!=0;
289
290 login_check_credentials();
291 if( !g.perm.Read ){ login_needed(); return; }
292 if( colorTest ){
293 showClosed = 0;
294 showAll = 1;
295 }
296
@@ -348,11 +348,11 @@
348 }
349 if( colorTest ){
350 const char *zColor = hash_color(zBr);
351 @ <li><span style="background-color: %s(zColor)">
352 @ %h(zBr) &rarr; %s(zColor)</span></li>
353 }else if( g.perm.History ){
354 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355 }else{
356 @ <li><b>%h(zBr)</b></li>
357 }
358 }
@@ -374,11 +374,11 @@
374 ** the timeline of a "brlist" page. Add some additional hyperlinks
375 ** to the end of the line.
376 */
377 static void brtimeline_extra(int rid){
378 Stmt q;
379 if( !g.perm.History ) return;
380 db_prepare(&q,
381 "SELECT substr(tagname,5) FROM tagxref, tag"
382 " WHERE tagxref.rid=%d"
383 " AND tagxref.tagid=tag.tagid"
384 " AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399 */
400 void brtimeline_page(void){
401 Stmt q;
402
403 login_check_credentials();
404 if( !g.perm.Read ){ login_needed(); return; }
405
406 style_header("Branches");
407 style_submenu_element("List", "List", "brlist");
408 login_anonymous_available();
409 @ <h2>The initial check-in for each branch:</h2>
410
+2 -2
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
7777
int i, j;
7878
char *zSep = "";
7979
8080
for(i=0; zPath[i]; i=j){
8181
for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82
- if( zPath[j] && g.okHistory ){
82
+ if( zPath[j] && g.perm.History ){
8383
if( zCI ){
8484
blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
8585
zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
8686
}else{
8787
blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118118
Blob dirname;
119119
Manifest *pM = 0;
120120
const char *zSubdirLink;
121121
122122
login_check_credentials();
123
- if( !g.okHistory ){ login_needed(); return; }
123
+ if( !g.perm.History ){ login_needed(); return; }
124124
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125125
style_header("File List");
126126
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127127
pathelementFunc, 0, 0);
128128
129129
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
77 int i, j;
78 char *zSep = "";
79
80 for(i=0; zPath[i]; i=j){
81 for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82 if( zPath[j] && g.okHistory ){
83 if( zCI ){
84 blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
85 zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
86 }else{
87 blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118 Blob dirname;
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.okHistory ){ login_needed(); return; }
124 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125 style_header("File List");
126 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127 pathelementFunc, 0, 0);
128
129
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
77 int i, j;
78 char *zSep = "";
79
80 for(i=0; zPath[i]; i=j){
81 for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82 if( zPath[j] && g.perm.History ){
83 if( zCI ){
84 blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
85 zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
86 }else{
87 blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118 Blob dirname;
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.perm.History ){ login_needed(); return; }
124 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125 style_header("File List");
126 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127 pathelementFunc, 0, 0);
128
129
+3 -3
--- src/clone.c
+++ src/clone.c
@@ -34,13 +34,13 @@
3434
** By default, your current login name is used to create the default
3535
** admin user. This can be overridden using the -A|--admin-user
3636
** parameter.
3737
**
3838
** Options:
39
-** --admin-user|-A USERNAME Make USERNAME the administrator
40
-** --private Also clone private branches
41
-** --ssl-identity=filename Use the SSL identity if requested by the server
39
+** --admin-user|-A USERNAME Make USERNAME the administrator
40
+** --private Also clone private branches
41
+** --ssl-identity=filename Use the SSL identity if requested by the server
4242
**
4343
** See also: init
4444
*/
4545
void clone_cmd(void){
4646
char *zPassword;
4747
--- src/clone.c
+++ src/clone.c
@@ -34,13 +34,13 @@
34 ** By default, your current login name is used to create the default
35 ** admin user. This can be overridden using the -A|--admin-user
36 ** parameter.
37 **
38 ** Options:
39 ** --admin-user|-A USERNAME Make USERNAME the administrator
40 ** --private Also clone private branches
41 ** --ssl-identity=filename Use the SSL identity if requested by the server
42 **
43 ** See also: init
44 */
45 void clone_cmd(void){
46 char *zPassword;
47
--- src/clone.c
+++ src/clone.c
@@ -34,13 +34,13 @@
34 ** By default, your current login name is used to create the default
35 ** admin user. This can be overridden using the -A|--admin-user
36 ** parameter.
37 **
38 ** Options:
39 ** --admin-user|-A USERNAME Make USERNAME the administrator
40 ** --private Also clone private branches
41 ** --ssl-identity=filename Use the SSL identity if requested by the server
42 **
43 ** See also: init
44 */
45 void clone_cmd(void){
46 char *zPassword;
47
+4 -4
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153153
n -= 2;
154154
}
155155
for(i=0; i<count(aConfig); i++){
156156
if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157157
int m = aConfig[i].groupMask;
158
- if( !g.okAdmin ){
158
+ if( !g.perm.Admin ){
159159
m &= ~CONFIGSET_USER;
160160
}
161
- if( !g.okRdAddr ){
161
+ if( !g.perm.RdAddr ){
162162
m &= ~CONFIGSET_ADDR;
163163
}
164164
return m;
165165
}
166166
}
@@ -553,11 +553,11 @@
553553
){
554554
const char *zName = blob_str(&aToken[1]);
555555
Blob content;
556556
blob_zero(&content);
557557
blob_extract(pIn, size, &content);
558
- g.okAdmin = g.okRdAddr = 1;
558
+ g.perm.Admin = g.perm.RdAddr = 1;
559559
configure_receive(zName, &content, groupMask);
560560
blob_reset(&content);
561561
blob_seek(pIn, 1, BLOB_SEEK_CUR);
562562
}
563563
}
@@ -776,11 +776,11 @@
776776
** the remote repository at URL.
777777
**
778778
** Options:
779779
** -R|--repository FILE Extract info from repository FILE
780780
**
781
-** See also: set
781
+** See also: settings, unset
782782
*/
783783
void configuration_cmd(void){
784784
int n;
785785
const char *zMethod;
786786
if( g.argc<3 ){
787787
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.okAdmin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.okRdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.okAdmin = g.okRdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
@@ -776,11 +776,11 @@
776 ** the remote repository at URL.
777 **
778 ** Options:
779 ** -R|--repository FILE Extract info from repository FILE
780 **
781 ** See also: set
782 */
783 void configuration_cmd(void){
784 int n;
785 const char *zMethod;
786 if( g.argc<3 ){
787
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.perm.Admin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.perm.RdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.perm.Admin = g.perm.RdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
@@ -776,11 +776,11 @@
776 ** the remote repository at URL.
777 **
778 ** Options:
779 ** -R|--repository FILE Extract info from repository FILE
780 **
781 ** See also: settings, unset
782 */
783 void configuration_cmd(void){
784 int n;
785 const char *zMethod;
786 if( g.argc<3 ){
787
+4 -4
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153153
n -= 2;
154154
}
155155
for(i=0; i<count(aConfig); i++){
156156
if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157157
int m = aConfig[i].groupMask;
158
- if( !g.okAdmin ){
158
+ if( !g.perm.Admin ){
159159
m &= ~CONFIGSET_USER;
160160
}
161
- if( !g.okRdAddr ){
161
+ if( !g.perm.RdAddr ){
162162
m &= ~CONFIGSET_ADDR;
163163
}
164164
return m;
165165
}
166166
}
@@ -553,11 +553,11 @@
553553
){
554554
const char *zName = blob_str(&aToken[1]);
555555
Blob content;
556556
blob_zero(&content);
557557
blob_extract(pIn, size, &content);
558
- g.okAdmin = g.okRdAddr = 1;
558
+ g.perm.Admin = g.perm.RdAddr = 1;
559559
configure_receive(zName, &content, groupMask);
560560
blob_reset(&content);
561561
blob_seek(pIn, 1, BLOB_SEEK_CUR);
562562
}
563563
}
@@ -776,11 +776,11 @@
776776
** the remote repository at URL.
777777
**
778778
** Options:
779779
** -R|--repository FILE Extract info from repository FILE
780780
**
781
-** See also: set
781
+** See also: settings, unset
782782
*/
783783
void configuration_cmd(void){
784784
int n;
785785
const char *zMethod;
786786
if( g.argc<3 ){
787787
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.okAdmin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.okRdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.okAdmin = g.okRdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
@@ -776,11 +776,11 @@
776 ** the remote repository at URL.
777 **
778 ** Options:
779 ** -R|--repository FILE Extract info from repository FILE
780 **
781 ** See also: set
782 */
783 void configuration_cmd(void){
784 int n;
785 const char *zMethod;
786 if( g.argc<3 ){
787
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.perm.Admin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.perm.RdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.perm.Admin = g.perm.RdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
@@ -776,11 +776,11 @@
776 ** the remote repository at URL.
777 **
778 ** Options:
779 ** -R|--repository FILE Extract info from repository FILE
780 **
781 ** See also: settings, unset
782 */
783 void configuration_cmd(void){
784 int n;
785 const char *zMethod;
786 if( g.argc<3 ){
787
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313313
** standard output, or if the optional 4th argument is given, in
314314
** the named output file.
315315
**
316316
** Options:
317317
** -R|--repository FILE Extract artifacts from repository FILE
318
+**
319
+** See also: finfo
318320
*/
319321
void artifact_cmd(void){
320322
int rid;
321323
Blob content;
322324
const char *zFile;
323325
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313 ** standard output, or if the optional 4th argument is given, in
314 ** the named output file.
315 **
316 ** Options:
317 ** -R|--repository FILE Extract artifacts from repository FILE
 
 
318 */
319 void artifact_cmd(void){
320 int rid;
321 Blob content;
322 const char *zFile;
323
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313 ** standard output, or if the optional 4th argument is given, in
314 ** the named output file.
315 **
316 ** Options:
317 ** -R|--repository FILE Extract artifacts from repository FILE
318 **
319 ** See also: finfo
320 */
321 void artifact_cmd(void){
322 int rid;
323 Blob content;
324 const char *zFile;
325
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313313
** standard output, or if the optional 4th argument is given, in
314314
** the named output file.
315315
**
316316
** Options:
317317
** -R|--repository FILE Extract artifacts from repository FILE
318
+**
319
+** See also: finfo
318320
*/
319321
void artifact_cmd(void){
320322
int rid;
321323
Blob content;
322324
const char *zFile;
323325
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313 ** standard output, or if the optional 4th argument is given, in
314 ** the named output file.
315 **
316 ** Options:
317 ** -R|--repository FILE Extract artifacts from repository FILE
 
 
318 */
319 void artifact_cmd(void){
320 int rid;
321 Blob content;
322 const char *zFile;
323
--- src/content.c
+++ src/content.c
@@ -313,10 +313,12 @@
313 ** standard output, or if the optional 4th argument is given, in
314 ** the named output file.
315 **
316 ** Options:
317 ** -R|--repository FILE Extract artifacts from repository FILE
318 **
319 ** See also: finfo
320 */
321 void artifact_cmd(void){
322 int rid;
323 Blob content;
324 const char *zFile;
325
+9 -3
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
13441344
** In either case, the string returned is stored in space obtained
13451345
** from malloc and should be freed by the calling function.
13461346
*/
13471347
char *db_reveal(const char *zKey){
13481348
char *zOut;
1349
- if( g.okRdAddr ){
1349
+ if( g.perm.RdAddr ){
13501350
zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
13511351
}else{
13521352
zOut = 0;
13531353
}
13541354
if( zOut==0 ){
@@ -1801,12 +1801,12 @@
18011801
18021802
/*
18031803
** COMMAND: settings
18041804
** COMMAND: unset
18051805
**
1806
-** %fossil settings ?PROPERTY? ?VALUE? ?-global?
1807
-** %fossil unset PROPERTY ?-global?
1806
+** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
1807
+** %fossil unset PROPERTY ?OPTIONS?
18081808
**
18091809
** The "settings" command with no arguments lists all properties and their
18101810
** values. With just a property name it shows the value of that property.
18111811
** With a value argument it changes the property for the current repository.
18121812
**
@@ -1950,10 +1950,16 @@
19501950
**
19511951
** web-browser A shell command used to launch your preferred
19521952
** web browser when given a URL as an argument.
19531953
** Defaults to "start" on windows, "open" on Mac,
19541954
** and "firefox" on Unix.
1955
+**
1956
+** Options:
1957
+** --global set or unset the given property globally instead of
1958
+** setting or unsetting it for the open repository only.
1959
+**
1960
+** See also: configuration
19551961
*/
19561962
void setting_cmd(void){
19571963
int i;
19581964
int globalFlag = find_option("global","g",0)!=0;
19591965
int unsetFlag = g.argv[1][0]=='u';
19601966
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.okRdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
@@ -1801,12 +1801,12 @@
1801
1802 /*
1803 ** COMMAND: settings
1804 ** COMMAND: unset
1805 **
1806 ** %fossil settings ?PROPERTY? ?VALUE? ?-global?
1807 ** %fossil unset PROPERTY ?-global?
1808 **
1809 ** The "settings" command with no arguments lists all properties and their
1810 ** values. With just a property name it shows the value of that property.
1811 ** With a value argument it changes the property for the current repository.
1812 **
@@ -1950,10 +1950,16 @@
1950 **
1951 ** web-browser A shell command used to launch your preferred
1952 ** web browser when given a URL as an argument.
1953 ** Defaults to "start" on windows, "open" on Mac,
1954 ** and "firefox" on Unix.
 
 
 
 
 
 
1955 */
1956 void setting_cmd(void){
1957 int i;
1958 int globalFlag = find_option("global","g",0)!=0;
1959 int unsetFlag = g.argv[1][0]=='u';
1960
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.perm.RdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
@@ -1801,12 +1801,12 @@
1801
1802 /*
1803 ** COMMAND: settings
1804 ** COMMAND: unset
1805 **
1806 ** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
1807 ** %fossil unset PROPERTY ?OPTIONS?
1808 **
1809 ** The "settings" command with no arguments lists all properties and their
1810 ** values. With just a property name it shows the value of that property.
1811 ** With a value argument it changes the property for the current repository.
1812 **
@@ -1950,10 +1950,16 @@
1950 **
1951 ** web-browser A shell command used to launch your preferred
1952 ** web browser when given a URL as an argument.
1953 ** Defaults to "start" on windows, "open" on Mac,
1954 ** and "firefox" on Unix.
1955 **
1956 ** Options:
1957 ** --global set or unset the given property globally instead of
1958 ** setting or unsetting it for the open repository only.
1959 **
1960 ** See also: configuration
1961 */
1962 void setting_cmd(void){
1963 int i;
1964 int globalFlag = find_option("global","g",0)!=0;
1965 int unsetFlag = g.argv[1][0]=='u';
1966
+9 -3
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
13441344
** In either case, the string returned is stored in space obtained
13451345
** from malloc and should be freed by the calling function.
13461346
*/
13471347
char *db_reveal(const char *zKey){
13481348
char *zOut;
1349
- if( g.okRdAddr ){
1349
+ if( g.perm.RdAddr ){
13501350
zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
13511351
}else{
13521352
zOut = 0;
13531353
}
13541354
if( zOut==0 ){
@@ -1801,12 +1801,12 @@
18011801
18021802
/*
18031803
** COMMAND: settings
18041804
** COMMAND: unset
18051805
**
1806
-** %fossil settings ?PROPERTY? ?VALUE? ?-global?
1807
-** %fossil unset PROPERTY ?-global?
1806
+** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
1807
+** %fossil unset PROPERTY ?OPTIONS?
18081808
**
18091809
** The "settings" command with no arguments lists all properties and their
18101810
** values. With just a property name it shows the value of that property.
18111811
** With a value argument it changes the property for the current repository.
18121812
**
@@ -1950,10 +1950,16 @@
19501950
**
19511951
** web-browser A shell command used to launch your preferred
19521952
** web browser when given a URL as an argument.
19531953
** Defaults to "start" on windows, "open" on Mac,
19541954
** and "firefox" on Unix.
1955
+**
1956
+** Options:
1957
+** --global set or unset the given property globally instead of
1958
+** setting or unsetting it for the open repository only.
1959
+**
1960
+** See also: configuration
19551961
*/
19561962
void setting_cmd(void){
19571963
int i;
19581964
int globalFlag = find_option("global","g",0)!=0;
19591965
int unsetFlag = g.argv[1][0]=='u';
19601966
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.okRdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
@@ -1801,12 +1801,12 @@
1801
1802 /*
1803 ** COMMAND: settings
1804 ** COMMAND: unset
1805 **
1806 ** %fossil settings ?PROPERTY? ?VALUE? ?-global?
1807 ** %fossil unset PROPERTY ?-global?
1808 **
1809 ** The "settings" command with no arguments lists all properties and their
1810 ** values. With just a property name it shows the value of that property.
1811 ** With a value argument it changes the property for the current repository.
1812 **
@@ -1950,10 +1950,16 @@
1950 **
1951 ** web-browser A shell command used to launch your preferred
1952 ** web browser when given a URL as an argument.
1953 ** Defaults to "start" on windows, "open" on Mac,
1954 ** and "firefox" on Unix.
 
 
 
 
 
 
1955 */
1956 void setting_cmd(void){
1957 int i;
1958 int globalFlag = find_option("global","g",0)!=0;
1959 int unsetFlag = g.argv[1][0]=='u';
1960
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.perm.RdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
@@ -1801,12 +1801,12 @@
1801
1802 /*
1803 ** COMMAND: settings
1804 ** COMMAND: unset
1805 **
1806 ** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
1807 ** %fossil unset PROPERTY ?OPTIONS?
1808 **
1809 ** The "settings" command with no arguments lists all properties and their
1810 ** values. With just a property name it shows the value of that property.
1811 ** With a value argument it changes the property for the current repository.
1812 **
@@ -1950,10 +1950,16 @@
1950 **
1951 ** web-browser A shell command used to launch your preferred
1952 ** web browser when given a URL as an argument.
1953 ** Defaults to "start" on windows, "open" on Mac,
1954 ** and "firefox" on Unix.
1955 **
1956 ** Options:
1957 ** --global set or unset the given property globally instead of
1958 ** setting or unsetting it for the open repository only.
1959 **
1960 ** See also: configuration
1961 */
1962 void setting_cmd(void){
1963 int i;
1964 int globalFlag = find_option("global","g",0)!=0;
1965 int unsetFlag = g.argv[1][0]=='u';
1966
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350350
Stmt q;
351351
int showAll = P("all")!=0;
352352
int showClosed = P("closed")!=0;
353353
354354
login_check_credentials();
355
- if( !g.okRead ){ login_needed(); return; }
355
+ if( !g.perm.Read ){ login_needed(); return; }
356356
357357
if( !showAll ){
358358
style_submenu_element("All", "All", "leaves?all");
359359
}
360360
if( !showClosed ){
361361
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350 Stmt q;
351 int showAll = P("all")!=0;
352 int showClosed = P("closed")!=0;
353
354 login_check_credentials();
355 if( !g.okRead ){ login_needed(); return; }
356
357 if( !showAll ){
358 style_submenu_element("All", "All", "leaves?all");
359 }
360 if( !showClosed ){
361
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350 Stmt q;
351 int showAll = P("all")!=0;
352 int showClosed = P("closed")!=0;
353
354 login_check_credentials();
355 if( !g.perm.Read ){ login_needed(); return; }
356
357 if( !showAll ){
358 style_submenu_element("All", "All", "leaves?all");
359 }
360 if( !showClosed ){
361
+4 -2
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837837
int iLimit;
838838
int annFlags = 0;
839839
Annotator ann;
840840
841841
login_check_credentials();
842
- if( !g.okRead ){ login_needed(); return; }
842
+ if( !g.perm.Read ){ login_needed(); return; }
843843
mid = name_to_typed_rid(PD("checkin","0"),"ci");
844844
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845845
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846846
iLimit = atoi(PD("limit","-1"));
847847
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848848
fossil_redirect_home();
849849
}
850850
style_header("File Annotation");
851851
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852
- annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
852
+ annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853853
if( P("log") ){
854854
int i;
855855
@ <h2>Versions analyzed:</h2>
856856
@ <ol>
857857
for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880880
**
881881
** Options:
882882
** --limit N Only look backwards in time by N versions
883883
** --log List all versions analyzed
884884
** --filevers Show file version numbers rather than check-in versions
885
+**
886
+** See also: info, finfo, timeline
885887
*/
886888
void annotate_cmd(void){
887889
int fnid; /* Filename ID */
888890
int fid; /* File instance ID */
889891
int mid; /* Manifest where file was checked in */
890892
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.okRead ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880 **
881 ** Options:
882 ** --limit N Only look backwards in time by N versions
883 ** --log List all versions analyzed
884 ** --filevers Show file version numbers rather than check-in versions
 
 
885 */
886 void annotate_cmd(void){
887 int fnid; /* Filename ID */
888 int fid; /* File instance ID */
889 int mid; /* Manifest where file was checked in */
890
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.perm.Read ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880 **
881 ** Options:
882 ** --limit N Only look backwards in time by N versions
883 ** --log List all versions analyzed
884 ** --filevers Show file version numbers rather than check-in versions
885 **
886 ** See also: info, finfo, timeline
887 */
888 void annotate_cmd(void){
889 int fnid; /* Filename ID */
890 int fid; /* File instance ID */
891 int mid; /* Manifest where file was checked in */
892
+4 -2
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837837
int iLimit;
838838
int annFlags = 0;
839839
Annotator ann;
840840
841841
login_check_credentials();
842
- if( !g.okRead ){ login_needed(); return; }
842
+ if( !g.perm.Read ){ login_needed(); return; }
843843
mid = name_to_typed_rid(PD("checkin","0"),"ci");
844844
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845845
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846846
iLimit = atoi(PD("limit","-1"));
847847
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848848
fossil_redirect_home();
849849
}
850850
style_header("File Annotation");
851851
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852
- annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
852
+ annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853853
if( P("log") ){
854854
int i;
855855
@ <h2>Versions analyzed:</h2>
856856
@ <ol>
857857
for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880880
**
881881
** Options:
882882
** --limit N Only look backwards in time by N versions
883883
** --log List all versions analyzed
884884
** --filevers Show file version numbers rather than check-in versions
885
+**
886
+** See also: info, finfo, timeline
885887
*/
886888
void annotate_cmd(void){
887889
int fnid; /* Filename ID */
888890
int fid; /* File instance ID */
889891
int mid; /* Manifest where file was checked in */
890892
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.okRead ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880 **
881 ** Options:
882 ** --limit N Only look backwards in time by N versions
883 ** --log List all versions analyzed
884 ** --filevers Show file version numbers rather than check-in versions
 
 
885 */
886 void annotate_cmd(void){
887 int fnid; /* Filename ID */
888 int fid; /* File instance ID */
889 int mid; /* Manifest where file was checked in */
890
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.perm.Read ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
@@ -880,10 +880,12 @@
880 **
881 ** Options:
882 ** --limit N Only look backwards in time by N versions
883 ** --log List all versions analyzed
884 ** --filevers Show file version numbers rather than check-in versions
885 **
886 ** See also: info, finfo, timeline
887 */
888 void annotate_cmd(void){
889 int fnid; /* Filename ID */
890 int fid; /* File instance ID */
891 int mid; /* Manifest where file was checked in */
892
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518518
*/
519519
void vpatch_page(void){
520520
const char *zFrom = P("from");
521521
const char *zTo = P("to");
522522
login_check_credentials();
523
- if( !g.okRead ){ login_needed(); return; }
523
+ if( !g.perm.Read ){ login_needed(); return; }
524524
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525525
526526
cgi_set_content_type("text/plain");
527527
diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528528
}
529529
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518 */
519 void vpatch_page(void){
520 const char *zFrom = P("from");
521 const char *zTo = P("to");
522 login_check_credentials();
523 if( !g.okRead ){ login_needed(); return; }
524 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525
526 cgi_set_content_type("text/plain");
527 diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528 }
529
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518 */
519 void vpatch_page(void){
520 const char *zFrom = P("from");
521 const char *zTo = P("to");
522 login_check_credentials();
523 if( !g.perm.Read ){ login_needed(); return; }
524 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525
526 cgi_set_content_type("text/plain");
527 diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528 }
529
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363363
int i; /* Loop counter */
364364
Blob filebody; /* Content of the documentation file */
365365
char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366366
367367
login_check_credentials();
368
- if( !g.okRead ){ login_needed(); return; }
368
+ if( !g.perm.Read ){ login_needed(); return; }
369369
zName = PD("name", "tip/index.wiki");
370370
for(i=0; zName[i] && zName[i]!='/'; i++){}
371371
if( zName[i]==0 || i>UUID_SIZE ){
372372
goto doc_not_found;
373373
}
374374
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363 int i; /* Loop counter */
364 Blob filebody; /* Content of the documentation file */
365 char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366
367 login_check_credentials();
368 if( !g.okRead ){ login_needed(); return; }
369 zName = PD("name", "tip/index.wiki");
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 goto doc_not_found;
373 }
374
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363 int i; /* Loop counter */
364 Blob filebody; /* Content of the documentation file */
365 char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366
367 login_check_credentials();
368 if( !g.perm.Read ){ login_needed(); return; }
369 zName = PD("name", "tip/index.wiki");
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 goto doc_not_found;
373 }
374
+6 -6
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
3636
char zShort[12];
3737
3838
zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
3939
tagid);
4040
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41
- if( g.okHistory ){
41
+ if( g.perm.History ){
4242
@ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
4343
}else{
4444
@ [%s(zShort)]
4545
}
4646
free(zEventId);
@@ -74,11 +74,11 @@
7474
7575
7676
/* wiki-read privilege is needed in order to read events.
7777
*/
7878
login_check_credentials();
79
- if( !g.okRdWiki ){
79
+ if( !g.perm.RdWiki ){
8080
login_needed();
8181
return;
8282
}
8383
8484
zEventId = P("name");
@@ -123,18 +123,18 @@
123123
style_header(blob_str(&title));
124124
}else{
125125
style_header("Event %S", zEventId);
126126
tail = fullbody;
127127
}
128
- if( g.okWrWiki && g.okWrite && nextRid==0 ){
128
+ if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){
129129
style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130130
g.zTop, zEventId);
131131
}
132132
zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133133
style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134134
g.zTop, zETime);
135
- if( g.okHistory ){
135
+ if( g.perm.History ){
136136
if( showDetail ){
137137
style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138138
g.zTop, zEventId, zUuid);
139139
if( nextRid ){
140140
char *zNext;
@@ -157,11 +157,11 @@
157157
"%s/event?name=%s&amp;aid=%s&amp;detail=1",
158158
g.zTop, zEventId, zUuid);
159159
}
160160
}
161161
162
- if( showDetail && g.okHistory ){
162
+ if( showDetail && g.perm.History ){
163163
int i;
164164
const char *zClr = 0;
165165
Blob comment;
166166
167167
zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236236
free(zTag);
237237
238238
/* Need both check-in and wiki-write or wiki-create privileges in order
239239
** to edit/create an event.
240240
*/
241
- if( !g.okWrite || (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
241
+ if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
242242
login_needed();
243243
return;
244244
}
245245
246246
/* Figure out the color */
247247
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
36 char zShort[12];
37
38 zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
39 tagid);
40 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41 if( g.okHistory ){
42 @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
43 }else{
44 @ [%s(zShort)]
45 }
46 free(zEventId);
@@ -74,11 +74,11 @@
74
75
76 /* wiki-read privilege is needed in order to read events.
77 */
78 login_check_credentials();
79 if( !g.okRdWiki ){
80 login_needed();
81 return;
82 }
83
84 zEventId = P("name");
@@ -123,18 +123,18 @@
123 style_header(blob_str(&title));
124 }else{
125 style_header("Event %S", zEventId);
126 tail = fullbody;
127 }
128 if( g.okWrWiki && g.okWrite && nextRid==0 ){
129 style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130 g.zTop, zEventId);
131 }
132 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133 style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134 g.zTop, zETime);
135 if( g.okHistory ){
136 if( showDetail ){
137 style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138 g.zTop, zEventId, zUuid);
139 if( nextRid ){
140 char *zNext;
@@ -157,11 +157,11 @@
157 "%s/event?name=%s&amp;aid=%s&amp;detail=1",
158 g.zTop, zEventId, zUuid);
159 }
160 }
161
162 if( showDetail && g.okHistory ){
163 int i;
164 const char *zClr = 0;
165 Blob comment;
166
167 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236 free(zTag);
237
238 /* Need both check-in and wiki-write or wiki-create privileges in order
239 ** to edit/create an event.
240 */
241 if( !g.okWrite || (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
242 login_needed();
243 return;
244 }
245
246 /* Figure out the color */
247
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
36 char zShort[12];
37
38 zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
39 tagid);
40 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41 if( g.perm.History ){
42 @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
43 }else{
44 @ [%s(zShort)]
45 }
46 free(zEventId);
@@ -74,11 +74,11 @@
74
75
76 /* wiki-read privilege is needed in order to read events.
77 */
78 login_check_credentials();
79 if( !g.perm.RdWiki ){
80 login_needed();
81 return;
82 }
83
84 zEventId = P("name");
@@ -123,18 +123,18 @@
123 style_header(blob_str(&title));
124 }else{
125 style_header("Event %S", zEventId);
126 tail = fullbody;
127 }
128 if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){
129 style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130 g.zTop, zEventId);
131 }
132 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133 style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134 g.zTop, zETime);
135 if( g.perm.History ){
136 if( showDetail ){
137 style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138 g.zTop, zEventId, zUuid);
139 if( nextRid ){
140 char *zNext;
@@ -157,11 +157,11 @@
157 "%s/event?name=%s&amp;aid=%s&amp;detail=1",
158 g.zTop, zEventId, zUuid);
159 }
160 }
161
162 if( showDetail && g.perm.History ){
163 int i;
164 const char *zClr = 0;
165 Blob comment;
166
167 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236 free(zTag);
237
238 /* Need both check-in and wiki-write or wiki-create privileges in order
239 ** to edit/create an event.
240 */
241 if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
242 login_needed();
243 return;
244 }
245
246 /* Figure out the color */
247
+4 -4
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
4848
** -p select print mode
4949
** --revision|-r R print the given revision (or ckout, if none is given)
5050
** to stdout (only in print mode)
5151
** -s select status mode (print a status indicator for FILE)
5252
**
53
-** See also: descendants, info, leaves
53
+** See also: artifact, descendants, info, leaves
5454
*/
5555
void finfo_cmd(void){
5656
db_must_be_within_tree();
5757
if (find_option("status","s",0)) {
5858
Stmt q;
@@ -222,11 +222,11 @@
222222
GraphContext *pGraph;
223223
int brBg = P("brbg")!=0;
224224
int uBg = P("ubg")!=0;
225225
226226
login_check_credentials();
227
- if( !g.okRead ){ login_needed(); return; }
227
+ if( !g.perm.Read ){ login_needed(); return; }
228228
style_header("File History");
229229
login_anonymous_available();
230230
231231
zPrevDate[0] = 0;
232232
zFilename = PD("name","");
@@ -309,11 +309,11 @@
309309
@ <td class="timelineTableCell">
310310
}
311311
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312312
sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313313
if( zUuid ){
314
- if( g.okHistory ){
314
+ if( g.perm.History ){
315315
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316316
}else{
317317
@ [%S(zUuid)]
318318
}
319319
@ part of check-in
@@ -322,11 +322,11 @@
322322
}
323323
hyperlink_to_uuid(zShortCkin);
324324
@ %h(zCom) (user:
325325
hyperlink_to_user(zUser, zDate, "");
326326
@ branch: %h(zBr))
327
- if( g.okHistory && zUuid ){
327
+ if( g.perm.History && zUuid ){
328328
const char *z = zFilename;
329329
if( fpid ){
330330
@ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331331
}
332332
@ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333333
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
52 **
53 ** See also: descendants, info, leaves
54 */
55 void finfo_cmd(void){
56 db_must_be_within_tree();
57 if (find_option("status","s",0)) {
58 Stmt q;
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.okRead ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.okHistory ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.okHistory && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
52 **
53 ** See also: artifact, descendants, info, leaves
54 */
55 void finfo_cmd(void){
56 db_must_be_within_tree();
57 if (find_option("status","s",0)) {
58 Stmt q;
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.perm.Read ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.perm.History ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.perm.History && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
+4 -4
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
4848
** -p select print mode
4949
** --revision|-r R print the given revision (or ckout, if none is given)
5050
** to stdout (only in print mode)
5151
** -s select status mode (print a status indicator for FILE)
5252
**
53
-** See also: descendants, info, leaves
53
+** See also: artifact, descendants, info, leaves
5454
*/
5555
void finfo_cmd(void){
5656
db_must_be_within_tree();
5757
if (find_option("status","s",0)) {
5858
Stmt q;
@@ -222,11 +222,11 @@
222222
GraphContext *pGraph;
223223
int brBg = P("brbg")!=0;
224224
int uBg = P("ubg")!=0;
225225
226226
login_check_credentials();
227
- if( !g.okRead ){ login_needed(); return; }
227
+ if( !g.perm.Read ){ login_needed(); return; }
228228
style_header("File History");
229229
login_anonymous_available();
230230
231231
zPrevDate[0] = 0;
232232
zFilename = PD("name","");
@@ -309,11 +309,11 @@
309309
@ <td class="timelineTableCell">
310310
}
311311
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312312
sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313313
if( zUuid ){
314
- if( g.okHistory ){
314
+ if( g.perm.History ){
315315
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316316
}else{
317317
@ [%S(zUuid)]
318318
}
319319
@ part of check-in
@@ -322,11 +322,11 @@
322322
}
323323
hyperlink_to_uuid(zShortCkin);
324324
@ %h(zCom) (user:
325325
hyperlink_to_user(zUser, zDate, "");
326326
@ branch: %h(zBr))
327
- if( g.okHistory && zUuid ){
327
+ if( g.perm.History && zUuid ){
328328
const char *z = zFilename;
329329
if( fpid ){
330330
@ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331331
}
332332
@ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333333
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
52 **
53 ** See also: descendants, info, leaves
54 */
55 void finfo_cmd(void){
56 db_must_be_within_tree();
57 if (find_option("status","s",0)) {
58 Stmt q;
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.okRead ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.okHistory ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.okHistory && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
--- src/finfo.c
+++ src/finfo.c
@@ -48,11 +48,11 @@
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
52 **
53 ** See also: artifact, descendants, info, leaves
54 */
55 void finfo_cmd(void){
56 db_must_be_within_tree();
57 if (find_option("status","s",0)) {
58 Stmt q;
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.perm.Read ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.perm.History ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.perm.History && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
+40 -34
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
8080
" FROM event WHERE objid=%d",
8181
rid
8282
);
8383
}
8484
if( showFamily ){
85
- db_prepare(&q, "SELECT uuid, pid FROM plink JOIN blob ON pid=rid "
86
- " WHERE cid=%d", rid);
85
+ db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid "
86
+ " WHERE cid=%d"
87
+ " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
8788
while( db_step(&q)==SQLITE_ROW ){
8889
const char *zUuid = db_column_text(&q, 0);
90
+ const char *zType = db_column_int(&q, 2) ? "parent:" : "merged-from:";
8991
zDate = db_text("",
9092
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
9193
db_column_int(&q, 1)
9294
);
93
- fossil_print("parent: %s %s\n", zUuid, zDate);
95
+ fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
9496
free(zDate);
9597
}
9698
db_finalize(&q);
97
- db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid "
98
- " WHERE pid=%d", rid);
99
+ db_prepare(&q, "SELECT uuid, cid, isprim FROM plink JOIN blob ON cid=rid "
100
+ " WHERE pid=%d"
101
+ " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
99102
while( db_step(&q)==SQLITE_ROW ){
100103
const char *zUuid = db_column_text(&q, 0);
104
+ const char *zType = db_column_int(&q, 2) ? "child:" : "merged-into:";
101105
zDate = db_text("",
102106
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
103107
db_column_int(&q, 1)
104108
);
105
- fossil_print("child: %s %s\n", zUuid, zDate);
109
+ fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
106110
free(zDate);
107111
}
108112
db_finalize(&q);
109113
}
110114
zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
135139
** file in a checkout.
136140
**
137141
** Options:
138142
**
139143
** -R|--repository FILE Extract info from repository FILE
144
+**
145
+** See also: annotate, artifact, finfo, timeline
140146
*/
141147
void info_cmd(void){
142148
i64 fsize;
143149
if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
144150
db_open_config(0);
@@ -285,11 +291,11 @@
285291
const char *zNew, /* blob.uuid after change. NULL for deletes */
286292
const char *zOldName, /* Prior name. NULL if no name change. */
287293
int showDiff, /* Show edit diffs if true */
288294
int mperm /* executable or symlink permission for zNew */
289295
){
290
- if( !g.okHistory ){
296
+ if( !g.perm.History ){
291297
if( zNew==0 ){
292298
@ <p>Deleted %h(zName)</p>
293299
}else if( zOld==0 ){
294300
@ <p>Added %h(zName)</p>
295301
}else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
362368
const char *zName; /* Name of the checkin to be displayed */
363369
const char *zUuid; /* UUID of zName */
364370
const char *zParent; /* UUID of the parent checkin (if any) */
365371
366372
login_check_credentials();
367
- if( !g.okRead ){ login_needed(); return; }
373
+ if( !g.perm.Read ){ login_needed(); return; }
368374
zName = P("name");
369375
rid = name_to_rid_www("name");
370376
if( rid==0 ){
371377
style_header("Check-in Information Error");
372378
@ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
410416
zDate = db_column_text(&q,1);
411417
zOrigDate = db_column_text(&q, 4);
412418
@ <div class="section">Overview</div>
413419
@ <table class="label-value">
414420
@ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
415
- if( g.okSetup ){
421
+ if( g.perm.Setup ){
416422
@ (Record ID: %d(rid))
417423
}
418424
@ </td></tr>
419425
@ <tr><th>Date:</th><td>
420426
hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
435441
@ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
436442
@ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
437443
}else{
438444
@ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
439445
}
440
- if( g.okAdmin ){
446
+ if( g.perm.Admin ){
441447
db_prepare(&q,
442448
"SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
443449
" FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
444450
" WHERE blob.rid=%d",
445451
rid
@@ -452,11 +458,11 @@
452458
@ <tr><th>Received&nbsp;From:</th>
453459
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
454460
}
455461
db_finalize(&q);
456462
}
457
- if( g.okHistory ){
463
+ if( g.perm.History ){
458464
const char *zProjName = db_get("project-name", "unnamed");
459465
@ <tr><th>Timelines:</th><td>
460466
@ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
461467
if( zParent ){
462468
@ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
478484
db_finalize(&q);
479485
@ </td></tr>
480486
@ <tr><th>Other&nbsp;Links:</th>
481487
@ <td>
482488
@ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
483
- if( g.okZip ){
489
+ if( g.perm.Zip ){
484490
char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
485491
g.zTop, zProjName, zUuid, zUuid);
486492
@ | <a href="%s(zUrl)">Tarball</a>
487493
@ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
488494
@ ZIP archive</a>
489495
fossil_free(zUrl);
490496
}
491497
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
492
- if( g.okWrite ){
498
+ if( g.perm.Write ){
493499
@ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
494500
}
495501
@ </td>
496502
@ </tr>
497503
}
@@ -554,11 +560,11 @@
554560
void winfo_page(void){
555561
Stmt q;
556562
int rid;
557563
558564
login_check_credentials();
559
- if( !g.okRdWiki ){ login_needed(); return; }
565
+ if( !g.perm.RdWiki ){ login_needed(); return; }
560566
rid = name_to_rid_www("name");
561567
if( rid==0 ){
562568
style_header("Wiki Page Information Error");
563569
@ No such object: %h(g.argv[2])
564570
style_footer();
@@ -587,16 +593,16 @@
587593
@ <div class="section">Overview</div>
588594
@ <p><table class="label-value">
589595
@ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
590596
@ <tr><th>Date:</th><td>
591597
hyperlink_to_date(zDate, "</td></tr>");
592
- if( g.okSetup ){
598
+ if( g.perm.Setup ){
593599
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
594600
}
595601
@ <tr><th>Original&nbsp;User:</th><td>
596602
hyperlink_to_user(zUser, zDate, "</td></tr>");
597
- if( g.okHistory ){
603
+ if( g.perm.History ){
598604
@ <tr><th>Commands:</th>
599605
@ <td>
600606
@ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
601607
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
602608
@ </td>
@@ -697,11 +703,11 @@
697703
int showDetail = 0;
698704
Manifest *pFrom, *pTo;
699705
ManifestFile *pFileFrom, *pFileTo;
700706
701707
login_check_credentials();
702
- if( !g.okRead ){ login_needed(); return; }
708
+ if( !g.perm.Read ){ login_needed(); return; }
703709
login_anonymous_available();
704710
705711
pFrom = vdiff_parse_manifest("from", &ridFrom);
706712
if( pFrom==0 ) return;
707713
pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
816822
}else if( mPerm==PERM_EXE ){
817823
@ <li>Executable file
818824
}else{
819825
@ <li>File
820826
}
821
- if( g.okHistory ){
827
+ if( g.perm.History ){
822828
@ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
823829
}else{
824830
@ %h(zName)
825831
}
826832
@ <ul>
@@ -829,20 +835,20 @@
829835
@ <li>
830836
hyperlink_to_date(zDate,"");
831837
@ - part of checkin
832838
hyperlink_to_uuid(zVers);
833839
if( zBr && zBr[0] ){
834
- if( g.okHistory ){
840
+ if( g.perm.History ){
835841
@ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
836842
}else{
837843
@ on branch %h(zBr)
838844
}
839845
}
840846
@ - %w(zCom) (user:
841847
hyperlink_to_user(zUser,zDate,"");
842848
@ )
843
- if( g.okHistory ){
849
+ if( g.perm.History ){
844850
@ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
845851
@ [annotate]</a>
846852
}
847853
cnt++;
848854
if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
869875
if( cnt>0 ){
870876
@ Also wiki page
871877
}else{
872878
@ Wiki page
873879
}
874
- if( g.okHistory ){
880
+ if( g.perm.History ){
875881
@ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
876882
}else{
877883
@ [%h(zPagename)]
878884
}
879885
@ by
@@ -945,17 +951,17 @@
945951
@ Also attachment "%h(zFilename)" to
946952
}else{
947953
@ Attachment "%h(zFilename)" to
948954
}
949955
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
950
- if( g.okHistory && g.okRdTkt ){
956
+ if( g.perm.History && g.perm.RdTkt ){
951957
@ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
952958
}else{
953959
@ ticket [%S(zTarget)]
954960
}
955961
}else{
956
- if( g.okHistory && g.okRdWiki ){
962
+ if( g.perm.History && g.perm.RdWiki ){
957963
@ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
958964
}else{
959965
@ wiki page [%h(zTarget)]
960966
}
961967
}
@@ -971,11 +977,11 @@
971977
if( cnt==0 ){
972978
@ Control artifact.
973979
if( pDownloadName && blob_size(pDownloadName)==0 ){
974980
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
975981
}
976
- }else if( linkToView && g.okHistory ){
982
+ }else if( linkToView && g.perm.History ){
977983
@ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
978984
}
979985
}
980986
981987
@@ -993,11 +999,11 @@
993999
Blob c1, c2, diff, *pOut;
9941000
char *zV1;
9951001
char *zV2;
9961002
9971003
login_check_credentials();
998
- if( !g.okRead ){ login_needed(); return; }
1004
+ if( !g.perm.Read ){ login_needed(); return; }
9991005
v1 = name_to_rid_www("v1");
10001006
v2 = name_to_rid_www("v2");
10011007
if( v1==0 || v2==0 ) fossil_redirect_home();
10021008
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
10031009
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
10451051
Blob content;
10461052
10471053
rid = name_to_rid_www("name");
10481054
zMime = PD("m","application/x-fossil-artifact");
10491055
login_check_credentials();
1050
- if( !g.okRead ){ login_needed(); return; }
1056
+ if( !g.perm.Read ){ login_needed(); return; }
10511057
if( rid==0 ) fossil_redirect_home();
10521058
content_get(rid, &content);
10531059
cgi_set_content_type(zMime);
10541060
cgi_set_content(&content);
10551061
}
@@ -1118,13 +1124,13 @@
11181124
Blob downloadName;
11191125
char *zUuid;
11201126
11211127
rid = name_to_rid_www("name");
11221128
login_check_credentials();
1123
- if( !g.okRead ){ login_needed(); return; }
1129
+ if( !g.perm.Read ){ login_needed(); return; }
11241130
if( rid==0 ) fossil_redirect_home();
1125
- if( g.okAdmin ){
1131
+ if( g.perm.Admin ){
11261132
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
11271133
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
11281134
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
11291135
g.zTop, zUuid);
11301136
}else{
@@ -1265,13 +1271,13 @@
12651271
if( rid==0 ){
12661272
rid = name_to_rid_www("name");
12671273
}
12681274
12691275
login_check_credentials();
1270
- if( !g.okRead ){ login_needed(); return; }
1276
+ if( !g.perm.Read ){ login_needed(); return; }
12711277
if( rid==0 ) fossil_redirect_home();
1272
- if( g.okAdmin ){
1278
+ if( g.perm.Admin ){
12731279
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
12741280
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
12751281
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
12761282
g.zTop, zUuid);
12771283
}else{
@@ -1352,15 +1358,15 @@
13521358
const char *zUuid;
13531359
char zTktName[20];
13541360
Manifest *pTktChng;
13551361
13561362
login_check_credentials();
1357
- if( !g.okRdTkt ){ login_needed(); return; }
1363
+ if( !g.perm.RdTkt ){ login_needed(); return; }
13581364
rid = name_to_rid_www("name");
13591365
if( rid==0 ){ fossil_redirect_home(); }
13601366
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1361
- if( g.okAdmin ){
1367
+ if( g.perm.Admin ){
13621368
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
13631369
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
13641370
g.zTop, zUuid);
13651371
}else{
13661372
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
13731379
}
13741380
style_header("Ticket Change Details");
13751381
zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
13761382
memcpy(zTktName, pTktChng->zTicketUuid, 10);
13771383
zTktName[10] = 0;
1378
- if( g.okHistory ){
1384
+ if( g.perm.History ){
13791385
@ <h2>Changes to ticket
13801386
@ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
13811387
@
13821388
@ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
13831389
@ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
16131619
char *zUuid;
16141620
Blob comment;
16151621
Stmt q;
16161622
16171623
login_check_credentials();
1618
- if( !g.okWrite ){ login_needed(); return; }
1624
+ if( !g.perm.Write ){ login_needed(); return; }
16191625
rid = name_to_typed_rid(P("r"), "ci");
16201626
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
16211627
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
16221628
" FROM event WHERE objid=%d", rid);
16231629
if( zComment==0 ) fossil_redirect_home();
16241630
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
80 " FROM event WHERE objid=%d",
81 rid
82 );
83 }
84 if( showFamily ){
85 db_prepare(&q, "SELECT uuid, pid FROM plink JOIN blob ON pid=rid "
86 " WHERE cid=%d", rid);
 
87 while( db_step(&q)==SQLITE_ROW ){
88 const char *zUuid = db_column_text(&q, 0);
 
89 zDate = db_text("",
90 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
91 db_column_int(&q, 1)
92 );
93 fossil_print("parent: %s %s\n", zUuid, zDate);
94 free(zDate);
95 }
96 db_finalize(&q);
97 db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid "
98 " WHERE pid=%d", rid);
 
99 while( db_step(&q)==SQLITE_ROW ){
100 const char *zUuid = db_column_text(&q, 0);
 
101 zDate = db_text("",
102 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
103 db_column_int(&q, 1)
104 );
105 fossil_print("child: %s %s\n", zUuid, zDate);
106 free(zDate);
107 }
108 db_finalize(&q);
109 }
110 zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
135 ** file in a checkout.
136 **
137 ** Options:
138 **
139 ** -R|--repository FILE Extract info from repository FILE
 
 
140 */
141 void info_cmd(void){
142 i64 fsize;
143 if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
144 db_open_config(0);
@@ -285,11 +291,11 @@
285 const char *zNew, /* blob.uuid after change. NULL for deletes */
286 const char *zOldName, /* Prior name. NULL if no name change. */
287 int showDiff, /* Show edit diffs if true */
288 int mperm /* executable or symlink permission for zNew */
289 ){
290 if( !g.okHistory ){
291 if( zNew==0 ){
292 @ <p>Deleted %h(zName)</p>
293 }else if( zOld==0 ){
294 @ <p>Added %h(zName)</p>
295 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
362 const char *zName; /* Name of the checkin to be displayed */
363 const char *zUuid; /* UUID of zName */
364 const char *zParent; /* UUID of the parent checkin (if any) */
365
366 login_check_credentials();
367 if( !g.okRead ){ login_needed(); return; }
368 zName = P("name");
369 rid = name_to_rid_www("name");
370 if( rid==0 ){
371 style_header("Check-in Information Error");
372 @ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
410 zDate = db_column_text(&q,1);
411 zOrigDate = db_column_text(&q, 4);
412 @ <div class="section">Overview</div>
413 @ <table class="label-value">
414 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
415 if( g.okSetup ){
416 @ (Record ID: %d(rid))
417 }
418 @ </td></tr>
419 @ <tr><th>Date:</th><td>
420 hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
435 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
436 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
437 }else{
438 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
439 }
440 if( g.okAdmin ){
441 db_prepare(&q,
442 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
443 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
444 " WHERE blob.rid=%d",
445 rid
@@ -452,11 +458,11 @@
452 @ <tr><th>Received&nbsp;From:</th>
453 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
454 }
455 db_finalize(&q);
456 }
457 if( g.okHistory ){
458 const char *zProjName = db_get("project-name", "unnamed");
459 @ <tr><th>Timelines:</th><td>
460 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
461 if( zParent ){
462 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
478 db_finalize(&q);
479 @ </td></tr>
480 @ <tr><th>Other&nbsp;Links:</th>
481 @ <td>
482 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
483 if( g.okZip ){
484 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
485 g.zTop, zProjName, zUuid, zUuid);
486 @ | <a href="%s(zUrl)">Tarball</a>
487 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
488 @ ZIP archive</a>
489 fossil_free(zUrl);
490 }
491 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
492 if( g.okWrite ){
493 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
494 }
495 @ </td>
496 @ </tr>
497 }
@@ -554,11 +560,11 @@
554 void winfo_page(void){
555 Stmt q;
556 int rid;
557
558 login_check_credentials();
559 if( !g.okRdWiki ){ login_needed(); return; }
560 rid = name_to_rid_www("name");
561 if( rid==0 ){
562 style_header("Wiki Page Information Error");
563 @ No such object: %h(g.argv[2])
564 style_footer();
@@ -587,16 +593,16 @@
587 @ <div class="section">Overview</div>
588 @ <p><table class="label-value">
589 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
590 @ <tr><th>Date:</th><td>
591 hyperlink_to_date(zDate, "</td></tr>");
592 if( g.okSetup ){
593 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
594 }
595 @ <tr><th>Original&nbsp;User:</th><td>
596 hyperlink_to_user(zUser, zDate, "</td></tr>");
597 if( g.okHistory ){
598 @ <tr><th>Commands:</th>
599 @ <td>
600 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
601 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
602 @ </td>
@@ -697,11 +703,11 @@
697 int showDetail = 0;
698 Manifest *pFrom, *pTo;
699 ManifestFile *pFileFrom, *pFileTo;
700
701 login_check_credentials();
702 if( !g.okRead ){ login_needed(); return; }
703 login_anonymous_available();
704
705 pFrom = vdiff_parse_manifest("from", &ridFrom);
706 if( pFrom==0 ) return;
707 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
816 }else if( mPerm==PERM_EXE ){
817 @ <li>Executable file
818 }else{
819 @ <li>File
820 }
821 if( g.okHistory ){
822 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
823 }else{
824 @ %h(zName)
825 }
826 @ <ul>
@@ -829,20 +835,20 @@
829 @ <li>
830 hyperlink_to_date(zDate,"");
831 @ - part of checkin
832 hyperlink_to_uuid(zVers);
833 if( zBr && zBr[0] ){
834 if( g.okHistory ){
835 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
836 }else{
837 @ on branch %h(zBr)
838 }
839 }
840 @ - %w(zCom) (user:
841 hyperlink_to_user(zUser,zDate,"");
842 @ )
843 if( g.okHistory ){
844 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
845 @ [annotate]</a>
846 }
847 cnt++;
848 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
869 if( cnt>0 ){
870 @ Also wiki page
871 }else{
872 @ Wiki page
873 }
874 if( g.okHistory ){
875 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
876 }else{
877 @ [%h(zPagename)]
878 }
879 @ by
@@ -945,17 +951,17 @@
945 @ Also attachment "%h(zFilename)" to
946 }else{
947 @ Attachment "%h(zFilename)" to
948 }
949 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
950 if( g.okHistory && g.okRdTkt ){
951 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
952 }else{
953 @ ticket [%S(zTarget)]
954 }
955 }else{
956 if( g.okHistory && g.okRdWiki ){
957 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
958 }else{
959 @ wiki page [%h(zTarget)]
960 }
961 }
@@ -971,11 +977,11 @@
971 if( cnt==0 ){
972 @ Control artifact.
973 if( pDownloadName && blob_size(pDownloadName)==0 ){
974 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
975 }
976 }else if( linkToView && g.okHistory ){
977 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
978 }
979 }
980
981
@@ -993,11 +999,11 @@
993 Blob c1, c2, diff, *pOut;
994 char *zV1;
995 char *zV2;
996
997 login_check_credentials();
998 if( !g.okRead ){ login_needed(); return; }
999 v1 = name_to_rid_www("v1");
1000 v2 = name_to_rid_www("v2");
1001 if( v1==0 || v2==0 ) fossil_redirect_home();
1002 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1003 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
1045 Blob content;
1046
1047 rid = name_to_rid_www("name");
1048 zMime = PD("m","application/x-fossil-artifact");
1049 login_check_credentials();
1050 if( !g.okRead ){ login_needed(); return; }
1051 if( rid==0 ) fossil_redirect_home();
1052 content_get(rid, &content);
1053 cgi_set_content_type(zMime);
1054 cgi_set_content(&content);
1055 }
@@ -1118,13 +1124,13 @@
1118 Blob downloadName;
1119 char *zUuid;
1120
1121 rid = name_to_rid_www("name");
1122 login_check_credentials();
1123 if( !g.okRead ){ login_needed(); return; }
1124 if( rid==0 ) fossil_redirect_home();
1125 if( g.okAdmin ){
1126 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1127 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1128 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1129 g.zTop, zUuid);
1130 }else{
@@ -1265,13 +1271,13 @@
1265 if( rid==0 ){
1266 rid = name_to_rid_www("name");
1267 }
1268
1269 login_check_credentials();
1270 if( !g.okRead ){ login_needed(); return; }
1271 if( rid==0 ) fossil_redirect_home();
1272 if( g.okAdmin ){
1273 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1274 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1275 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1276 g.zTop, zUuid);
1277 }else{
@@ -1352,15 +1358,15 @@
1352 const char *zUuid;
1353 char zTktName[20];
1354 Manifest *pTktChng;
1355
1356 login_check_credentials();
1357 if( !g.okRdTkt ){ login_needed(); return; }
1358 rid = name_to_rid_www("name");
1359 if( rid==0 ){ fossil_redirect_home(); }
1360 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1361 if( g.okAdmin ){
1362 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1363 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1364 g.zTop, zUuid);
1365 }else{
1366 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
1373 }
1374 style_header("Ticket Change Details");
1375 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1376 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1377 zTktName[10] = 0;
1378 if( g.okHistory ){
1379 @ <h2>Changes to ticket
1380 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1381 @
1382 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1383 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
1613 char *zUuid;
1614 Blob comment;
1615 Stmt q;
1616
1617 login_check_credentials();
1618 if( !g.okWrite ){ login_needed(); return; }
1619 rid = name_to_typed_rid(P("r"), "ci");
1620 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1621 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1622 " FROM event WHERE objid=%d", rid);
1623 if( zComment==0 ) fossil_redirect_home();
1624
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
80 " FROM event WHERE objid=%d",
81 rid
82 );
83 }
84 if( showFamily ){
85 db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid "
86 " WHERE cid=%d"
87 " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
88 while( db_step(&q)==SQLITE_ROW ){
89 const char *zUuid = db_column_text(&q, 0);
90 const char *zType = db_column_int(&q, 2) ? "parent:" : "merged-from:";
91 zDate = db_text("",
92 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
93 db_column_int(&q, 1)
94 );
95 fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
96 free(zDate);
97 }
98 db_finalize(&q);
99 db_prepare(&q, "SELECT uuid, cid, isprim FROM plink JOIN blob ON cid=rid "
100 " WHERE pid=%d"
101 " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
102 while( db_step(&q)==SQLITE_ROW ){
103 const char *zUuid = db_column_text(&q, 0);
104 const char *zType = db_column_int(&q, 2) ? "child:" : "merged-into:";
105 zDate = db_text("",
106 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
107 db_column_int(&q, 1)
108 );
109 fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
110 free(zDate);
111 }
112 db_finalize(&q);
113 }
114 zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
139 ** file in a checkout.
140 **
141 ** Options:
142 **
143 ** -R|--repository FILE Extract info from repository FILE
144 **
145 ** See also: annotate, artifact, finfo, timeline
146 */
147 void info_cmd(void){
148 i64 fsize;
149 if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
150 db_open_config(0);
@@ -285,11 +291,11 @@
291 const char *zNew, /* blob.uuid after change. NULL for deletes */
292 const char *zOldName, /* Prior name. NULL if no name change. */
293 int showDiff, /* Show edit diffs if true */
294 int mperm /* executable or symlink permission for zNew */
295 ){
296 if( !g.perm.History ){
297 if( zNew==0 ){
298 @ <p>Deleted %h(zName)</p>
299 }else if( zOld==0 ){
300 @ <p>Added %h(zName)</p>
301 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
368 const char *zName; /* Name of the checkin to be displayed */
369 const char *zUuid; /* UUID of zName */
370 const char *zParent; /* UUID of the parent checkin (if any) */
371
372 login_check_credentials();
373 if( !g.perm.Read ){ login_needed(); return; }
374 zName = P("name");
375 rid = name_to_rid_www("name");
376 if( rid==0 ){
377 style_header("Check-in Information Error");
378 @ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
416 zDate = db_column_text(&q,1);
417 zOrigDate = db_column_text(&q, 4);
418 @ <div class="section">Overview</div>
419 @ <table class="label-value">
420 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
421 if( g.perm.Setup ){
422 @ (Record ID: %d(rid))
423 }
424 @ </td></tr>
425 @ <tr><th>Date:</th><td>
426 hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
441 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
442 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
443 }else{
444 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
445 }
446 if( g.perm.Admin ){
447 db_prepare(&q,
448 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
449 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
450 " WHERE blob.rid=%d",
451 rid
@@ -452,11 +458,11 @@
458 @ <tr><th>Received&nbsp;From:</th>
459 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
460 }
461 db_finalize(&q);
462 }
463 if( g.perm.History ){
464 const char *zProjName = db_get("project-name", "unnamed");
465 @ <tr><th>Timelines:</th><td>
466 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
467 if( zParent ){
468 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
484 db_finalize(&q);
485 @ </td></tr>
486 @ <tr><th>Other&nbsp;Links:</th>
487 @ <td>
488 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
489 if( g.perm.Zip ){
490 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
491 g.zTop, zProjName, zUuid, zUuid);
492 @ | <a href="%s(zUrl)">Tarball</a>
493 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
494 @ ZIP archive</a>
495 fossil_free(zUrl);
496 }
497 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
498 if( g.perm.Write ){
499 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
500 }
501 @ </td>
502 @ </tr>
503 }
@@ -554,11 +560,11 @@
560 void winfo_page(void){
561 Stmt q;
562 int rid;
563
564 login_check_credentials();
565 if( !g.perm.RdWiki ){ login_needed(); return; }
566 rid = name_to_rid_www("name");
567 if( rid==0 ){
568 style_header("Wiki Page Information Error");
569 @ No such object: %h(g.argv[2])
570 style_footer();
@@ -587,16 +593,16 @@
593 @ <div class="section">Overview</div>
594 @ <p><table class="label-value">
595 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
596 @ <tr><th>Date:</th><td>
597 hyperlink_to_date(zDate, "</td></tr>");
598 if( g.perm.Setup ){
599 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
600 }
601 @ <tr><th>Original&nbsp;User:</th><td>
602 hyperlink_to_user(zUser, zDate, "</td></tr>");
603 if( g.perm.History ){
604 @ <tr><th>Commands:</th>
605 @ <td>
606 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
607 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
608 @ </td>
@@ -697,11 +703,11 @@
703 int showDetail = 0;
704 Manifest *pFrom, *pTo;
705 ManifestFile *pFileFrom, *pFileTo;
706
707 login_check_credentials();
708 if( !g.perm.Read ){ login_needed(); return; }
709 login_anonymous_available();
710
711 pFrom = vdiff_parse_manifest("from", &ridFrom);
712 if( pFrom==0 ) return;
713 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
822 }else if( mPerm==PERM_EXE ){
823 @ <li>Executable file
824 }else{
825 @ <li>File
826 }
827 if( g.perm.History ){
828 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
829 }else{
830 @ %h(zName)
831 }
832 @ <ul>
@@ -829,20 +835,20 @@
835 @ <li>
836 hyperlink_to_date(zDate,"");
837 @ - part of checkin
838 hyperlink_to_uuid(zVers);
839 if( zBr && zBr[0] ){
840 if( g.perm.History ){
841 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
842 }else{
843 @ on branch %h(zBr)
844 }
845 }
846 @ - %w(zCom) (user:
847 hyperlink_to_user(zUser,zDate,"");
848 @ )
849 if( g.perm.History ){
850 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
851 @ [annotate]</a>
852 }
853 cnt++;
854 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
875 if( cnt>0 ){
876 @ Also wiki page
877 }else{
878 @ Wiki page
879 }
880 if( g.perm.History ){
881 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
882 }else{
883 @ [%h(zPagename)]
884 }
885 @ by
@@ -945,17 +951,17 @@
951 @ Also attachment "%h(zFilename)" to
952 }else{
953 @ Attachment "%h(zFilename)" to
954 }
955 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
956 if( g.perm.History && g.perm.RdTkt ){
957 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
958 }else{
959 @ ticket [%S(zTarget)]
960 }
961 }else{
962 if( g.perm.History && g.perm.RdWiki ){
963 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
964 }else{
965 @ wiki page [%h(zTarget)]
966 }
967 }
@@ -971,11 +977,11 @@
977 if( cnt==0 ){
978 @ Control artifact.
979 if( pDownloadName && blob_size(pDownloadName)==0 ){
980 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
981 }
982 }else if( linkToView && g.perm.History ){
983 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
984 }
985 }
986
987
@@ -993,11 +999,11 @@
999 Blob c1, c2, diff, *pOut;
1000 char *zV1;
1001 char *zV2;
1002
1003 login_check_credentials();
1004 if( !g.perm.Read ){ login_needed(); return; }
1005 v1 = name_to_rid_www("v1");
1006 v2 = name_to_rid_www("v2");
1007 if( v1==0 || v2==0 ) fossil_redirect_home();
1008 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1009 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
1051 Blob content;
1052
1053 rid = name_to_rid_www("name");
1054 zMime = PD("m","application/x-fossil-artifact");
1055 login_check_credentials();
1056 if( !g.perm.Read ){ login_needed(); return; }
1057 if( rid==0 ) fossil_redirect_home();
1058 content_get(rid, &content);
1059 cgi_set_content_type(zMime);
1060 cgi_set_content(&content);
1061 }
@@ -1118,13 +1124,13 @@
1124 Blob downloadName;
1125 char *zUuid;
1126
1127 rid = name_to_rid_www("name");
1128 login_check_credentials();
1129 if( !g.perm.Read ){ login_needed(); return; }
1130 if( rid==0 ) fossil_redirect_home();
1131 if( g.perm.Admin ){
1132 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1133 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1134 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1135 g.zTop, zUuid);
1136 }else{
@@ -1265,13 +1271,13 @@
1271 if( rid==0 ){
1272 rid = name_to_rid_www("name");
1273 }
1274
1275 login_check_credentials();
1276 if( !g.perm.Read ){ login_needed(); return; }
1277 if( rid==0 ) fossil_redirect_home();
1278 if( g.perm.Admin ){
1279 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1280 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1281 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1282 g.zTop, zUuid);
1283 }else{
@@ -1352,15 +1358,15 @@
1358 const char *zUuid;
1359 char zTktName[20];
1360 Manifest *pTktChng;
1361
1362 login_check_credentials();
1363 if( !g.perm.RdTkt ){ login_needed(); return; }
1364 rid = name_to_rid_www("name");
1365 if( rid==0 ){ fossil_redirect_home(); }
1366 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1367 if( g.perm.Admin ){
1368 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1369 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1370 g.zTop, zUuid);
1371 }else{
1372 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
1379 }
1380 style_header("Ticket Change Details");
1381 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1382 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1383 zTktName[10] = 0;
1384 if( g.perm.History ){
1385 @ <h2>Changes to ticket
1386 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1387 @
1388 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1389 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
1619 char *zUuid;
1620 Blob comment;
1621 Stmt q;
1622
1623 login_check_credentials();
1624 if( !g.perm.Write ){ login_needed(); return; }
1625 rid = name_to_typed_rid(P("r"), "ci");
1626 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1627 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1628 " FROM event WHERE objid=%d", rid);
1629 if( zComment==0 ) fossil_redirect_home();
1630
+40 -34
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
8080
" FROM event WHERE objid=%d",
8181
rid
8282
);
8383
}
8484
if( showFamily ){
85
- db_prepare(&q, "SELECT uuid, pid FROM plink JOIN blob ON pid=rid "
86
- " WHERE cid=%d", rid);
85
+ db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid "
86
+ " WHERE cid=%d"
87
+ " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
8788
while( db_step(&q)==SQLITE_ROW ){
8889
const char *zUuid = db_column_text(&q, 0);
90
+ const char *zType = db_column_int(&q, 2) ? "parent:" : "merged-from:";
8991
zDate = db_text("",
9092
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
9193
db_column_int(&q, 1)
9294
);
93
- fossil_print("parent: %s %s\n", zUuid, zDate);
95
+ fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
9496
free(zDate);
9597
}
9698
db_finalize(&q);
97
- db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid "
98
- " WHERE pid=%d", rid);
99
+ db_prepare(&q, "SELECT uuid, cid, isprim FROM plink JOIN blob ON cid=rid "
100
+ " WHERE pid=%d"
101
+ " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
99102
while( db_step(&q)==SQLITE_ROW ){
100103
const char *zUuid = db_column_text(&q, 0);
104
+ const char *zType = db_column_int(&q, 2) ? "child:" : "merged-into:";
101105
zDate = db_text("",
102106
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
103107
db_column_int(&q, 1)
104108
);
105
- fossil_print("child: %s %s\n", zUuid, zDate);
109
+ fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
106110
free(zDate);
107111
}
108112
db_finalize(&q);
109113
}
110114
zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
135139
** file in a checkout.
136140
**
137141
** Options:
138142
**
139143
** -R|--repository FILE Extract info from repository FILE
144
+**
145
+** See also: annotate, artifact, finfo, timeline
140146
*/
141147
void info_cmd(void){
142148
i64 fsize;
143149
if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
144150
db_open_config(0);
@@ -285,11 +291,11 @@
285291
const char *zNew, /* blob.uuid after change. NULL for deletes */
286292
const char *zOldName, /* Prior name. NULL if no name change. */
287293
int showDiff, /* Show edit diffs if true */
288294
int mperm /* executable or symlink permission for zNew */
289295
){
290
- if( !g.okHistory ){
296
+ if( !g.perm.History ){
291297
if( zNew==0 ){
292298
@ <p>Deleted %h(zName)</p>
293299
}else if( zOld==0 ){
294300
@ <p>Added %h(zName)</p>
295301
}else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
362368
const char *zName; /* Name of the checkin to be displayed */
363369
const char *zUuid; /* UUID of zName */
364370
const char *zParent; /* UUID of the parent checkin (if any) */
365371
366372
login_check_credentials();
367
- if( !g.okRead ){ login_needed(); return; }
373
+ if( !g.perm.Read ){ login_needed(); return; }
368374
zName = P("name");
369375
rid = name_to_rid_www("name");
370376
if( rid==0 ){
371377
style_header("Check-in Information Error");
372378
@ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
410416
zDate = db_column_text(&q,1);
411417
zOrigDate = db_column_text(&q, 4);
412418
@ <div class="section">Overview</div>
413419
@ <table class="label-value">
414420
@ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
415
- if( g.okSetup ){
421
+ if( g.perm.Setup ){
416422
@ (Record ID: %d(rid))
417423
}
418424
@ </td></tr>
419425
@ <tr><th>Date:</th><td>
420426
hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
435441
@ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
436442
@ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
437443
}else{
438444
@ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
439445
}
440
- if( g.okAdmin ){
446
+ if( g.perm.Admin ){
441447
db_prepare(&q,
442448
"SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
443449
" FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
444450
" WHERE blob.rid=%d",
445451
rid
@@ -452,11 +458,11 @@
452458
@ <tr><th>Received&nbsp;From:</th>
453459
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
454460
}
455461
db_finalize(&q);
456462
}
457
- if( g.okHistory ){
463
+ if( g.perm.History ){
458464
const char *zProjName = db_get("project-name", "unnamed");
459465
@ <tr><th>Timelines:</th><td>
460466
@ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
461467
if( zParent ){
462468
@ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
478484
db_finalize(&q);
479485
@ </td></tr>
480486
@ <tr><th>Other&nbsp;Links:</th>
481487
@ <td>
482488
@ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
483
- if( g.okZip ){
489
+ if( g.perm.Zip ){
484490
char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
485491
g.zTop, zProjName, zUuid, zUuid);
486492
@ | <a href="%s(zUrl)">Tarball</a>
487493
@ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
488494
@ ZIP archive</a>
489495
fossil_free(zUrl);
490496
}
491497
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
492
- if( g.okWrite ){
498
+ if( g.perm.Write ){
493499
@ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
494500
}
495501
@ </td>
496502
@ </tr>
497503
}
@@ -554,11 +560,11 @@
554560
void winfo_page(void){
555561
Stmt q;
556562
int rid;
557563
558564
login_check_credentials();
559
- if( !g.okRdWiki ){ login_needed(); return; }
565
+ if( !g.perm.RdWiki ){ login_needed(); return; }
560566
rid = name_to_rid_www("name");
561567
if( rid==0 ){
562568
style_header("Wiki Page Information Error");
563569
@ No such object: %h(g.argv[2])
564570
style_footer();
@@ -587,16 +593,16 @@
587593
@ <div class="section">Overview</div>
588594
@ <p><table class="label-value">
589595
@ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
590596
@ <tr><th>Date:</th><td>
591597
hyperlink_to_date(zDate, "</td></tr>");
592
- if( g.okSetup ){
598
+ if( g.perm.Setup ){
593599
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
594600
}
595601
@ <tr><th>Original&nbsp;User:</th><td>
596602
hyperlink_to_user(zUser, zDate, "</td></tr>");
597
- if( g.okHistory ){
603
+ if( g.perm.History ){
598604
@ <tr><th>Commands:</th>
599605
@ <td>
600606
@ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
601607
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
602608
@ </td>
@@ -697,11 +703,11 @@
697703
int showDetail = 0;
698704
Manifest *pFrom, *pTo;
699705
ManifestFile *pFileFrom, *pFileTo;
700706
701707
login_check_credentials();
702
- if( !g.okRead ){ login_needed(); return; }
708
+ if( !g.perm.Read ){ login_needed(); return; }
703709
login_anonymous_available();
704710
705711
pFrom = vdiff_parse_manifest("from", &ridFrom);
706712
if( pFrom==0 ) return;
707713
pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
816822
}else if( mPerm==PERM_EXE ){
817823
@ <li>Executable file
818824
}else{
819825
@ <li>File
820826
}
821
- if( g.okHistory ){
827
+ if( g.perm.History ){
822828
@ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
823829
}else{
824830
@ %h(zName)
825831
}
826832
@ <ul>
@@ -829,20 +835,20 @@
829835
@ <li>
830836
hyperlink_to_date(zDate,"");
831837
@ - part of checkin
832838
hyperlink_to_uuid(zVers);
833839
if( zBr && zBr[0] ){
834
- if( g.okHistory ){
840
+ if( g.perm.History ){
835841
@ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
836842
}else{
837843
@ on branch %h(zBr)
838844
}
839845
}
840846
@ - %w(zCom) (user:
841847
hyperlink_to_user(zUser,zDate,"");
842848
@ )
843
- if( g.okHistory ){
849
+ if( g.perm.History ){
844850
@ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
845851
@ [annotate]</a>
846852
}
847853
cnt++;
848854
if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
869875
if( cnt>0 ){
870876
@ Also wiki page
871877
}else{
872878
@ Wiki page
873879
}
874
- if( g.okHistory ){
880
+ if( g.perm.History ){
875881
@ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
876882
}else{
877883
@ [%h(zPagename)]
878884
}
879885
@ by
@@ -945,17 +951,17 @@
945951
@ Also attachment "%h(zFilename)" to
946952
}else{
947953
@ Attachment "%h(zFilename)" to
948954
}
949955
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
950
- if( g.okHistory && g.okRdTkt ){
956
+ if( g.perm.History && g.perm.RdTkt ){
951957
@ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
952958
}else{
953959
@ ticket [%S(zTarget)]
954960
}
955961
}else{
956
- if( g.okHistory && g.okRdWiki ){
962
+ if( g.perm.History && g.perm.RdWiki ){
957963
@ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
958964
}else{
959965
@ wiki page [%h(zTarget)]
960966
}
961967
}
@@ -971,11 +977,11 @@
971977
if( cnt==0 ){
972978
@ Control artifact.
973979
if( pDownloadName && blob_size(pDownloadName)==0 ){
974980
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
975981
}
976
- }else if( linkToView && g.okHistory ){
982
+ }else if( linkToView && g.perm.History ){
977983
@ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
978984
}
979985
}
980986
981987
@@ -993,11 +999,11 @@
993999
Blob c1, c2, diff, *pOut;
9941000
char *zV1;
9951001
char *zV2;
9961002
9971003
login_check_credentials();
998
- if( !g.okRead ){ login_needed(); return; }
1004
+ if( !g.perm.Read ){ login_needed(); return; }
9991005
v1 = name_to_rid_www("v1");
10001006
v2 = name_to_rid_www("v2");
10011007
if( v1==0 || v2==0 ) fossil_redirect_home();
10021008
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
10031009
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
10451051
Blob content;
10461052
10471053
rid = name_to_rid_www("name");
10481054
zMime = PD("m","application/x-fossil-artifact");
10491055
login_check_credentials();
1050
- if( !g.okRead ){ login_needed(); return; }
1056
+ if( !g.perm.Read ){ login_needed(); return; }
10511057
if( rid==0 ) fossil_redirect_home();
10521058
content_get(rid, &content);
10531059
cgi_set_content_type(zMime);
10541060
cgi_set_content(&content);
10551061
}
@@ -1118,13 +1124,13 @@
11181124
Blob downloadName;
11191125
char *zUuid;
11201126
11211127
rid = name_to_rid_www("name");
11221128
login_check_credentials();
1123
- if( !g.okRead ){ login_needed(); return; }
1129
+ if( !g.perm.Read ){ login_needed(); return; }
11241130
if( rid==0 ) fossil_redirect_home();
1125
- if( g.okAdmin ){
1131
+ if( g.perm.Admin ){
11261132
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
11271133
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
11281134
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
11291135
g.zTop, zUuid);
11301136
}else{
@@ -1265,13 +1271,13 @@
12651271
if( rid==0 ){
12661272
rid = name_to_rid_www("name");
12671273
}
12681274
12691275
login_check_credentials();
1270
- if( !g.okRead ){ login_needed(); return; }
1276
+ if( !g.perm.Read ){ login_needed(); return; }
12711277
if( rid==0 ) fossil_redirect_home();
1272
- if( g.okAdmin ){
1278
+ if( g.perm.Admin ){
12731279
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
12741280
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
12751281
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
12761282
g.zTop, zUuid);
12771283
}else{
@@ -1352,15 +1358,15 @@
13521358
const char *zUuid;
13531359
char zTktName[20];
13541360
Manifest *pTktChng;
13551361
13561362
login_check_credentials();
1357
- if( !g.okRdTkt ){ login_needed(); return; }
1363
+ if( !g.perm.RdTkt ){ login_needed(); return; }
13581364
rid = name_to_rid_www("name");
13591365
if( rid==0 ){ fossil_redirect_home(); }
13601366
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1361
- if( g.okAdmin ){
1367
+ if( g.perm.Admin ){
13621368
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
13631369
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
13641370
g.zTop, zUuid);
13651371
}else{
13661372
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
13731379
}
13741380
style_header("Ticket Change Details");
13751381
zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
13761382
memcpy(zTktName, pTktChng->zTicketUuid, 10);
13771383
zTktName[10] = 0;
1378
- if( g.okHistory ){
1384
+ if( g.perm.History ){
13791385
@ <h2>Changes to ticket
13801386
@ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
13811387
@
13821388
@ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
13831389
@ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
16131619
char *zUuid;
16141620
Blob comment;
16151621
Stmt q;
16161622
16171623
login_check_credentials();
1618
- if( !g.okWrite ){ login_needed(); return; }
1624
+ if( !g.perm.Write ){ login_needed(); return; }
16191625
rid = name_to_typed_rid(P("r"), "ci");
16201626
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
16211627
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
16221628
" FROM event WHERE objid=%d", rid);
16231629
if( zComment==0 ) fossil_redirect_home();
16241630
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
80 " FROM event WHERE objid=%d",
81 rid
82 );
83 }
84 if( showFamily ){
85 db_prepare(&q, "SELECT uuid, pid FROM plink JOIN blob ON pid=rid "
86 " WHERE cid=%d", rid);
 
87 while( db_step(&q)==SQLITE_ROW ){
88 const char *zUuid = db_column_text(&q, 0);
 
89 zDate = db_text("",
90 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
91 db_column_int(&q, 1)
92 );
93 fossil_print("parent: %s %s\n", zUuid, zDate);
94 free(zDate);
95 }
96 db_finalize(&q);
97 db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid "
98 " WHERE pid=%d", rid);
 
99 while( db_step(&q)==SQLITE_ROW ){
100 const char *zUuid = db_column_text(&q, 0);
 
101 zDate = db_text("",
102 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
103 db_column_int(&q, 1)
104 );
105 fossil_print("child: %s %s\n", zUuid, zDate);
106 free(zDate);
107 }
108 db_finalize(&q);
109 }
110 zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
135 ** file in a checkout.
136 **
137 ** Options:
138 **
139 ** -R|--repository FILE Extract info from repository FILE
 
 
140 */
141 void info_cmd(void){
142 i64 fsize;
143 if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
144 db_open_config(0);
@@ -285,11 +291,11 @@
285 const char *zNew, /* blob.uuid after change. NULL for deletes */
286 const char *zOldName, /* Prior name. NULL if no name change. */
287 int showDiff, /* Show edit diffs if true */
288 int mperm /* executable or symlink permission for zNew */
289 ){
290 if( !g.okHistory ){
291 if( zNew==0 ){
292 @ <p>Deleted %h(zName)</p>
293 }else if( zOld==0 ){
294 @ <p>Added %h(zName)</p>
295 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
362 const char *zName; /* Name of the checkin to be displayed */
363 const char *zUuid; /* UUID of zName */
364 const char *zParent; /* UUID of the parent checkin (if any) */
365
366 login_check_credentials();
367 if( !g.okRead ){ login_needed(); return; }
368 zName = P("name");
369 rid = name_to_rid_www("name");
370 if( rid==0 ){
371 style_header("Check-in Information Error");
372 @ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
410 zDate = db_column_text(&q,1);
411 zOrigDate = db_column_text(&q, 4);
412 @ <div class="section">Overview</div>
413 @ <table class="label-value">
414 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
415 if( g.okSetup ){
416 @ (Record ID: %d(rid))
417 }
418 @ </td></tr>
419 @ <tr><th>Date:</th><td>
420 hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
435 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
436 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
437 }else{
438 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
439 }
440 if( g.okAdmin ){
441 db_prepare(&q,
442 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
443 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
444 " WHERE blob.rid=%d",
445 rid
@@ -452,11 +458,11 @@
452 @ <tr><th>Received&nbsp;From:</th>
453 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
454 }
455 db_finalize(&q);
456 }
457 if( g.okHistory ){
458 const char *zProjName = db_get("project-name", "unnamed");
459 @ <tr><th>Timelines:</th><td>
460 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
461 if( zParent ){
462 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
478 db_finalize(&q);
479 @ </td></tr>
480 @ <tr><th>Other&nbsp;Links:</th>
481 @ <td>
482 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
483 if( g.okZip ){
484 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
485 g.zTop, zProjName, zUuid, zUuid);
486 @ | <a href="%s(zUrl)">Tarball</a>
487 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
488 @ ZIP archive</a>
489 fossil_free(zUrl);
490 }
491 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
492 if( g.okWrite ){
493 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
494 }
495 @ </td>
496 @ </tr>
497 }
@@ -554,11 +560,11 @@
554 void winfo_page(void){
555 Stmt q;
556 int rid;
557
558 login_check_credentials();
559 if( !g.okRdWiki ){ login_needed(); return; }
560 rid = name_to_rid_www("name");
561 if( rid==0 ){
562 style_header("Wiki Page Information Error");
563 @ No such object: %h(g.argv[2])
564 style_footer();
@@ -587,16 +593,16 @@
587 @ <div class="section">Overview</div>
588 @ <p><table class="label-value">
589 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
590 @ <tr><th>Date:</th><td>
591 hyperlink_to_date(zDate, "</td></tr>");
592 if( g.okSetup ){
593 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
594 }
595 @ <tr><th>Original&nbsp;User:</th><td>
596 hyperlink_to_user(zUser, zDate, "</td></tr>");
597 if( g.okHistory ){
598 @ <tr><th>Commands:</th>
599 @ <td>
600 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
601 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
602 @ </td>
@@ -697,11 +703,11 @@
697 int showDetail = 0;
698 Manifest *pFrom, *pTo;
699 ManifestFile *pFileFrom, *pFileTo;
700
701 login_check_credentials();
702 if( !g.okRead ){ login_needed(); return; }
703 login_anonymous_available();
704
705 pFrom = vdiff_parse_manifest("from", &ridFrom);
706 if( pFrom==0 ) return;
707 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
816 }else if( mPerm==PERM_EXE ){
817 @ <li>Executable file
818 }else{
819 @ <li>File
820 }
821 if( g.okHistory ){
822 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
823 }else{
824 @ %h(zName)
825 }
826 @ <ul>
@@ -829,20 +835,20 @@
829 @ <li>
830 hyperlink_to_date(zDate,"");
831 @ - part of checkin
832 hyperlink_to_uuid(zVers);
833 if( zBr && zBr[0] ){
834 if( g.okHistory ){
835 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
836 }else{
837 @ on branch %h(zBr)
838 }
839 }
840 @ - %w(zCom) (user:
841 hyperlink_to_user(zUser,zDate,"");
842 @ )
843 if( g.okHistory ){
844 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
845 @ [annotate]</a>
846 }
847 cnt++;
848 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
869 if( cnt>0 ){
870 @ Also wiki page
871 }else{
872 @ Wiki page
873 }
874 if( g.okHistory ){
875 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
876 }else{
877 @ [%h(zPagename)]
878 }
879 @ by
@@ -945,17 +951,17 @@
945 @ Also attachment "%h(zFilename)" to
946 }else{
947 @ Attachment "%h(zFilename)" to
948 }
949 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
950 if( g.okHistory && g.okRdTkt ){
951 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
952 }else{
953 @ ticket [%S(zTarget)]
954 }
955 }else{
956 if( g.okHistory && g.okRdWiki ){
957 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
958 }else{
959 @ wiki page [%h(zTarget)]
960 }
961 }
@@ -971,11 +977,11 @@
971 if( cnt==0 ){
972 @ Control artifact.
973 if( pDownloadName && blob_size(pDownloadName)==0 ){
974 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
975 }
976 }else if( linkToView && g.okHistory ){
977 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
978 }
979 }
980
981
@@ -993,11 +999,11 @@
993 Blob c1, c2, diff, *pOut;
994 char *zV1;
995 char *zV2;
996
997 login_check_credentials();
998 if( !g.okRead ){ login_needed(); return; }
999 v1 = name_to_rid_www("v1");
1000 v2 = name_to_rid_www("v2");
1001 if( v1==0 || v2==0 ) fossil_redirect_home();
1002 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1003 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
1045 Blob content;
1046
1047 rid = name_to_rid_www("name");
1048 zMime = PD("m","application/x-fossil-artifact");
1049 login_check_credentials();
1050 if( !g.okRead ){ login_needed(); return; }
1051 if( rid==0 ) fossil_redirect_home();
1052 content_get(rid, &content);
1053 cgi_set_content_type(zMime);
1054 cgi_set_content(&content);
1055 }
@@ -1118,13 +1124,13 @@
1118 Blob downloadName;
1119 char *zUuid;
1120
1121 rid = name_to_rid_www("name");
1122 login_check_credentials();
1123 if( !g.okRead ){ login_needed(); return; }
1124 if( rid==0 ) fossil_redirect_home();
1125 if( g.okAdmin ){
1126 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1127 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1128 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1129 g.zTop, zUuid);
1130 }else{
@@ -1265,13 +1271,13 @@
1265 if( rid==0 ){
1266 rid = name_to_rid_www("name");
1267 }
1268
1269 login_check_credentials();
1270 if( !g.okRead ){ login_needed(); return; }
1271 if( rid==0 ) fossil_redirect_home();
1272 if( g.okAdmin ){
1273 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1274 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1275 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1276 g.zTop, zUuid);
1277 }else{
@@ -1352,15 +1358,15 @@
1352 const char *zUuid;
1353 char zTktName[20];
1354 Manifest *pTktChng;
1355
1356 login_check_credentials();
1357 if( !g.okRdTkt ){ login_needed(); return; }
1358 rid = name_to_rid_www("name");
1359 if( rid==0 ){ fossil_redirect_home(); }
1360 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1361 if( g.okAdmin ){
1362 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1363 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1364 g.zTop, zUuid);
1365 }else{
1366 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
1373 }
1374 style_header("Ticket Change Details");
1375 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1376 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1377 zTktName[10] = 0;
1378 if( g.okHistory ){
1379 @ <h2>Changes to ticket
1380 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1381 @
1382 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1383 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
1613 char *zUuid;
1614 Blob comment;
1615 Stmt q;
1616
1617 login_check_credentials();
1618 if( !g.okWrite ){ login_needed(); return; }
1619 rid = name_to_typed_rid(P("r"), "ci");
1620 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1621 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1622 " FROM event WHERE objid=%d", rid);
1623 if( zComment==0 ) fossil_redirect_home();
1624
--- src/info.c
+++ src/info.c
@@ -80,31 +80,35 @@
80 " FROM event WHERE objid=%d",
81 rid
82 );
83 }
84 if( showFamily ){
85 db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid "
86 " WHERE cid=%d"
87 " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
88 while( db_step(&q)==SQLITE_ROW ){
89 const char *zUuid = db_column_text(&q, 0);
90 const char *zType = db_column_int(&q, 2) ? "parent:" : "merged-from:";
91 zDate = db_text("",
92 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
93 db_column_int(&q, 1)
94 );
95 fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
96 free(zDate);
97 }
98 db_finalize(&q);
99 db_prepare(&q, "SELECT uuid, cid, isprim FROM plink JOIN blob ON cid=rid "
100 " WHERE pid=%d"
101 " ORDER BY isprim DESC, mtime DESC /*sort*/", rid);
102 while( db_step(&q)==SQLITE_ROW ){
103 const char *zUuid = db_column_text(&q, 0);
104 const char *zType = db_column_int(&q, 2) ? "child:" : "merged-into:";
105 zDate = db_text("",
106 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
107 db_column_int(&q, 1)
108 );
109 fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
110 free(zDate);
111 }
112 db_finalize(&q);
113 }
114 zTags = info_tags_of_checkin(rid, 0);
@@ -135,10 +139,12 @@
139 ** file in a checkout.
140 **
141 ** Options:
142 **
143 ** -R|--repository FILE Extract info from repository FILE
144 **
145 ** See also: annotate, artifact, finfo, timeline
146 */
147 void info_cmd(void){
148 i64 fsize;
149 if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
150 db_open_config(0);
@@ -285,11 +291,11 @@
291 const char *zNew, /* blob.uuid after change. NULL for deletes */
292 const char *zOldName, /* Prior name. NULL if no name change. */
293 int showDiff, /* Show edit diffs if true */
294 int mperm /* executable or symlink permission for zNew */
295 ){
296 if( !g.perm.History ){
297 if( zNew==0 ){
298 @ <p>Deleted %h(zName)</p>
299 }else if( zOld==0 ){
300 @ <p>Added %h(zName)</p>
301 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -362,11 +368,11 @@
368 const char *zName; /* Name of the checkin to be displayed */
369 const char *zUuid; /* UUID of zName */
370 const char *zParent; /* UUID of the parent checkin (if any) */
371
372 login_check_credentials();
373 if( !g.perm.Read ){ login_needed(); return; }
374 zName = P("name");
375 rid = name_to_rid_www("name");
376 if( rid==0 ){
377 style_header("Check-in Information Error");
378 @ No such object: %h(g.argv[2])
@@ -410,11 +416,11 @@
416 zDate = db_column_text(&q,1);
417 zOrigDate = db_column_text(&q, 4);
418 @ <div class="section">Overview</div>
419 @ <table class="label-value">
420 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
421 if( g.perm.Setup ){
422 @ (Record ID: %d(rid))
423 }
424 @ </td></tr>
425 @ <tr><th>Date:</th><td>
426 hyperlink_to_date(zDate, "</td></tr>");
@@ -435,11 +441,11 @@
441 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
442 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
443 }else{
444 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
445 }
446 if( g.perm.Admin ){
447 db_prepare(&q,
448 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
449 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
450 " WHERE blob.rid=%d",
451 rid
@@ -452,11 +458,11 @@
458 @ <tr><th>Received&nbsp;From:</th>
459 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
460 }
461 db_finalize(&q);
462 }
463 if( g.perm.History ){
464 const char *zProjName = db_get("project-name", "unnamed");
465 @ <tr><th>Timelines:</th><td>
466 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
467 if( zParent ){
468 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -478,20 +484,20 @@
484 db_finalize(&q);
485 @ </td></tr>
486 @ <tr><th>Other&nbsp;Links:</th>
487 @ <td>
488 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
489 if( g.perm.Zip ){
490 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
491 g.zTop, zProjName, zUuid, zUuid);
492 @ | <a href="%s(zUrl)">Tarball</a>
493 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
494 @ ZIP archive</a>
495 fossil_free(zUrl);
496 }
497 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
498 if( g.perm.Write ){
499 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
500 }
501 @ </td>
502 @ </tr>
503 }
@@ -554,11 +560,11 @@
560 void winfo_page(void){
561 Stmt q;
562 int rid;
563
564 login_check_credentials();
565 if( !g.perm.RdWiki ){ login_needed(); return; }
566 rid = name_to_rid_www("name");
567 if( rid==0 ){
568 style_header("Wiki Page Information Error");
569 @ No such object: %h(g.argv[2])
570 style_footer();
@@ -587,16 +593,16 @@
593 @ <div class="section">Overview</div>
594 @ <p><table class="label-value">
595 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
596 @ <tr><th>Date:</th><td>
597 hyperlink_to_date(zDate, "</td></tr>");
598 if( g.perm.Setup ){
599 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
600 }
601 @ <tr><th>Original&nbsp;User:</th><td>
602 hyperlink_to_user(zUser, zDate, "</td></tr>");
603 if( g.perm.History ){
604 @ <tr><th>Commands:</th>
605 @ <td>
606 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
607 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
608 @ </td>
@@ -697,11 +703,11 @@
703 int showDetail = 0;
704 Manifest *pFrom, *pTo;
705 ManifestFile *pFileFrom, *pFileTo;
706
707 login_check_credentials();
708 if( !g.perm.Read ){ login_needed(); return; }
709 login_anonymous_available();
710
711 pFrom = vdiff_parse_manifest("from", &ridFrom);
712 if( pFrom==0 ) return;
713 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -816,11 +822,11 @@
822 }else if( mPerm==PERM_EXE ){
823 @ <li>Executable file
824 }else{
825 @ <li>File
826 }
827 if( g.perm.History ){
828 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
829 }else{
830 @ %h(zName)
831 }
832 @ <ul>
@@ -829,20 +835,20 @@
835 @ <li>
836 hyperlink_to_date(zDate,"");
837 @ - part of checkin
838 hyperlink_to_uuid(zVers);
839 if( zBr && zBr[0] ){
840 if( g.perm.History ){
841 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
842 }else{
843 @ on branch %h(zBr)
844 }
845 }
846 @ - %w(zCom) (user:
847 hyperlink_to_user(zUser,zDate,"");
848 @ )
849 if( g.perm.History ){
850 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
851 @ [annotate]</a>
852 }
853 cnt++;
854 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -869,11 +875,11 @@
875 if( cnt>0 ){
876 @ Also wiki page
877 }else{
878 @ Wiki page
879 }
880 if( g.perm.History ){
881 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
882 }else{
883 @ [%h(zPagename)]
884 }
885 @ by
@@ -945,17 +951,17 @@
951 @ Also attachment "%h(zFilename)" to
952 }else{
953 @ Attachment "%h(zFilename)" to
954 }
955 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
956 if( g.perm.History && g.perm.RdTkt ){
957 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
958 }else{
959 @ ticket [%S(zTarget)]
960 }
961 }else{
962 if( g.perm.History && g.perm.RdWiki ){
963 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
964 }else{
965 @ wiki page [%h(zTarget)]
966 }
967 }
@@ -971,11 +977,11 @@
977 if( cnt==0 ){
978 @ Control artifact.
979 if( pDownloadName && blob_size(pDownloadName)==0 ){
980 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
981 }
982 }else if( linkToView && g.perm.History ){
983 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
984 }
985 }
986
987
@@ -993,11 +999,11 @@
999 Blob c1, c2, diff, *pOut;
1000 char *zV1;
1001 char *zV2;
1002
1003 login_check_credentials();
1004 if( !g.perm.Read ){ login_needed(); return; }
1005 v1 = name_to_rid_www("v1");
1006 v2 = name_to_rid_www("v2");
1007 if( v1==0 || v2==0 ) fossil_redirect_home();
1008 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1009 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1045,11 +1051,11 @@
1051 Blob content;
1052
1053 rid = name_to_rid_www("name");
1054 zMime = PD("m","application/x-fossil-artifact");
1055 login_check_credentials();
1056 if( !g.perm.Read ){ login_needed(); return; }
1057 if( rid==0 ) fossil_redirect_home();
1058 content_get(rid, &content);
1059 cgi_set_content_type(zMime);
1060 cgi_set_content(&content);
1061 }
@@ -1118,13 +1124,13 @@
1124 Blob downloadName;
1125 char *zUuid;
1126
1127 rid = name_to_rid_www("name");
1128 login_check_credentials();
1129 if( !g.perm.Read ){ login_needed(); return; }
1130 if( rid==0 ) fossil_redirect_home();
1131 if( g.perm.Admin ){
1132 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1133 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1134 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1135 g.zTop, zUuid);
1136 }else{
@@ -1265,13 +1271,13 @@
1271 if( rid==0 ){
1272 rid = name_to_rid_www("name");
1273 }
1274
1275 login_check_credentials();
1276 if( !g.perm.Read ){ login_needed(); return; }
1277 if( rid==0 ) fossil_redirect_home();
1278 if( g.perm.Admin ){
1279 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1280 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1281 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1282 g.zTop, zUuid);
1283 }else{
@@ -1352,15 +1358,15 @@
1358 const char *zUuid;
1359 char zTktName[20];
1360 Manifest *pTktChng;
1361
1362 login_check_credentials();
1363 if( !g.perm.RdTkt ){ login_needed(); return; }
1364 rid = name_to_rid_www("name");
1365 if( rid==0 ){ fossil_redirect_home(); }
1366 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1367 if( g.perm.Admin ){
1368 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1369 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1370 g.zTop, zUuid);
1371 }else{
1372 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1373,11 +1379,11 @@
1379 }
1380 style_header("Ticket Change Details");
1381 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1382 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1383 zTktName[10] = 0;
1384 if( g.perm.History ){
1385 @ <h2>Changes to ticket
1386 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1387 @
1388 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1389 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1613,11 +1619,11 @@
1619 char *zUuid;
1620 Blob comment;
1621 Stmt q;
1622
1623 login_check_credentials();
1624 if( !g.perm.Write ){ login_needed(); return; }
1625 rid = name_to_typed_rid(P("r"), "ci");
1626 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1627 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1628 " FROM event WHERE objid=%d", rid);
1629 if( zComment==0 ) fossil_redirect_home();
1630
+55 -76
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226226
/* To logout, change the cookie value to an empty string */
227227
const char *zCookieName = login_cookie_name();
228228
cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229229
redirect_to_g();
230230
}
231
- if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
231
+ if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232232
/* The user requests a password change */
233233
zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234234
if( db_int(1, "SELECT 0 FROM user"
235235
" WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236236
g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431431
@ <p>To log off the system (and delete your login cookie)
432432
@ press the following button:<br />
433433
@ <input type="submit" name="out" value="Logout" /></p>
434434
}
435435
@ </form>
436
- if( g.okPassword ){
436
+ if( g.perm.Password ){
437437
@ <hr />
438438
@ <p>To change your password, enter your old password and your
439439
@ new password twice below then press the "Change Password"
440440
@ button.</p>
441441
@ <form action="login" method="post">
@@ -541,11 +541,11 @@
541541
542542
/*
543543
** This routine examines the login cookie to see if it exists and
544544
** and is valid. If the login cookie checks out, it then sets
545545
** global variables appropriately. Global variables set include
546
-** g.userUid and g.zLogin and of the g.okRead family of permission
546
+** g.userUid and g.zLogin and of the g.perm.Read family of permission
547547
** booleans.
548548
**
549549
*/
550550
void login_check_credentials(void){
551551
int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725725
*/
726726
void login_set_capabilities(const char *zCap, unsigned flags){
727727
int i;
728728
for(i=0; zCap[i]; i++){
729729
switch( zCap[i] ){
730
- case 's': g.okSetup = 1; /* Fall thru into Admin */
731
- case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
732
- g.okRdWiki = g.okWrWiki = g.okNewWiki =
733
- g.okApndWiki = g.okHistory = g.okClone =
734
- g.okNewTkt = g.okPassword = g.okRdAddr =
735
- g.okTktFmt = g.okAttach = g.okApndTkt = 1;
730
+ case 's': g.perm.Setup = 1; /* Fall thru into Admin */
731
+ case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip =
732
+ g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki =
733
+ g.perm.ApndWiki = g.perm.History = g.perm.Clone =
734
+ g.perm.NewTkt = g.perm.Password = g.perm.RdAddr =
735
+ g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1;
736736
/* Fall thru into Read/Write */
737
- case 'i': g.okRead = g.okWrite = 1; break;
738
- case 'o': g.okRead = 1; break;
739
- case 'z': g.okZip = 1; break;
740
-
741
- case 'd': g.okDelete = 1; break;
742
- case 'h': g.okHistory = 1; break;
743
- case 'g': g.okClone = 1; break;
744
- case 'p': g.okPassword = 1; break;
745
-
746
- case 'j': g.okRdWiki = 1; break;
747
- case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
748
- case 'm': g.okApndWiki = 1; break;
749
- case 'f': g.okNewWiki = 1; break;
750
-
751
- case 'e': g.okRdAddr = 1; break;
752
- case 'r': g.okRdTkt = 1; break;
753
- case 'n': g.okNewTkt = 1; break;
754
- case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
755
- g.okApndTkt = 1; break;
756
- case 'c': g.okApndTkt = 1; break;
757
- case 't': g.okTktFmt = 1; break;
758
- case 'b': g.okAttach = 1; break;
759
- case 'x': g.okPrivate = 1; break;
737
+ case 'i': g.perm.Read = g.perm.Write = 1; break;
738
+ case 'o': g.perm.Read = 1; break;
739
+ case 'z': g.perm.Zip = 1; break;
740
+
741
+ case 'd': g.perm.Delete = 1; break;
742
+ case 'h': g.perm.History = 1; break;
743
+ case 'g': g.perm.Clone = 1; break;
744
+ case 'p': g.perm.Password = 1; break;
745
+
746
+ case 'j': g.perm.RdWiki = 1; break;
747
+ case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break;
748
+ case 'm': g.perm.ApndWiki = 1; break;
749
+ case 'f': g.perm.NewWiki = 1; break;
750
+
751
+ case 'e': g.perm.RdAddr = 1; break;
752
+ case 'r': g.perm.RdTkt = 1; break;
753
+ case 'n': g.perm.NewTkt = 1; break;
754
+ case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt =
755
+ g.perm.ApndTkt = 1; break;
756
+ case 'c': g.perm.ApndTkt = 1; break;
757
+ case 't': g.perm.TktFmt = 1; break;
758
+ case 'b': g.perm.Attach = 1; break;
759
+ case 'x': g.perm.Private = 1; break;
760760
761761
/* The "u" privileges is a little different. It recursively
762762
** inherits all privileges of the user named "reader" */
763763
case 'u': {
764764
if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792792
int i;
793793
int rc = 1;
794794
if( nCap<0 ) nCap = strlen(zCap);
795795
for(i=0; i<nCap && rc && zCap[i]; i++){
796796
switch( zCap[i] ){
797
- case 'a': rc = g.okAdmin; break;
798
- case 'b': rc = g.okAttach; break;
799
- case 'c': rc = g.okApndTkt; break;
800
- case 'd': rc = g.okDelete; break;
801
- case 'e': rc = g.okRdAddr; break;
802
- case 'f': rc = g.okNewWiki; break;
803
- case 'g': rc = g.okClone; break;
804
- case 'h': rc = g.okHistory; break;
805
- case 'i': rc = g.okWrite; break;
806
- case 'j': rc = g.okRdWiki; break;
807
- case 'k': rc = g.okWrWiki; break;
797
+ case 'a': rc = g.perm.Admin; break;
798
+ case 'b': rc = g.perm.Attach; break;
799
+ case 'c': rc = g.perm.ApndTkt; break;
800
+ case 'd': rc = g.perm.Delete; break;
801
+ case 'e': rc = g.perm.RdAddr; break;
802
+ case 'f': rc = g.perm.NewWiki; break;
803
+ case 'g': rc = g.perm.Clone; break;
804
+ case 'h': rc = g.perm.History; break;
805
+ case 'i': rc = g.perm.Write; break;
806
+ case 'j': rc = g.perm.RdWiki; break;
807
+ case 'k': rc = g.perm.WrWiki; break;
808808
/* case 'l': */
809
- case 'm': rc = g.okApndWiki; break;
810
- case 'n': rc = g.okNewTkt; break;
811
- case 'o': rc = g.okRead; break;
812
- case 'p': rc = g.okPassword; break;
809
+ case 'm': rc = g.perm.ApndWiki; break;
810
+ case 'n': rc = g.perm.NewTkt; break;
811
+ case 'o': rc = g.perm.Read; break;
812
+ case 'p': rc = g.perm.Password; break;
813813
/* case 'q': */
814
- case 'r': rc = g.okRdTkt; break;
815
- case 's': rc = g.okSetup; break;
816
- case 't': rc = g.okTktFmt; break;
814
+ case 'r': rc = g.perm.RdTkt; break;
815
+ case 's': rc = g.perm.Setup; break;
816
+ case 't': rc = g.perm.TktFmt; break;
817817
/* case 'u': READER */
818818
/* case 'v': DEVELOPER */
819
- case 'w': rc = g.okWrTkt; break;
820
- case 'x': rc = g.okPrivate; break;
819
+ case 'w': rc = g.perm.WrTkt; break;
820
+ case 'x': rc = g.perm.Private; break;
821821
/* case 'y': */
822
- case 'z': rc = g.okZip; break;
822
+ case 'z': rc = g.perm.Zip; break;
823823
default: rc = 0; break;
824824
}
825825
}
826826
return rc;
827827
}
@@ -831,32 +831,11 @@
831831
*/
832832
void login_as_user(const char *zUser){
833833
char *zCap = ""; /* New capabilities */
834834
835835
/* Turn off all capabilities from prior logins */
836
- g.okSetup = 0;
837
- g.okAdmin = 0;
838
- g.okDelete = 0;
839
- g.okPassword = 0;
840
- g.okQuery = 0;
841
- g.okWrite = 0;
842
- g.okRead = 0;
843
- g.okHistory = 0;
844
- g.okClone = 0;
845
- g.okRdWiki = 0;
846
- g.okNewWiki = 0;
847
- g.okApndWiki = 0;
848
- g.okWrWiki = 0;
849
- g.okRdTkt = 0;
850
- g.okNewTkt = 0;
851
- g.okApndTkt = 0;
852
- g.okWrTkt = 0;
853
- g.okAttach = 0;
854
- g.okTktFmt = 0;
855
- g.okRdAddr = 0;
856
- g.okZip = 0;
857
- g.okPrivate = 0;
836
+ memset( &g.perm, 0, sizeof(g.perm) );
858837
859838
/* Set the global variables recording the userid and login. The
860839
** "nobody" user is a special case in that g.zLogin==0.
861840
*/
862841
g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
892871
** the anonymous user has okHistory permission, then paint a mesage
893872
** to inform the user that much more information is available by
894873
** logging in as anonymous.
895874
*/
896875
void login_anonymous_available(void){
897
- if( !g.okHistory &&
876
+ if( !g.perm.History &&
898877
db_exists("SELECT 1 FROM user"
899878
" WHERE login='anonymous'"
900879
" AND cap LIKE '%%h%%'") ){
901880
const char *zUrl = PD("REQUEST_URI", "index");
902881
@ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
903882
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226 /* To logout, change the cookie value to an empty string */
227 const char *zCookieName = login_cookie_name();
228 cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229 redirect_to_g();
230 }
231 if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232 /* The user requests a password change */
233 zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234 if( db_int(1, "SELECT 0 FROM user"
235 " WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236 g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431 @ <p>To log off the system (and delete your login cookie)
432 @ press the following button:<br />
433 @ <input type="submit" name="out" value="Logout" /></p>
434 }
435 @ </form>
436 if( g.okPassword ){
437 @ <hr />
438 @ <p>To change your password, enter your old password and your
439 @ new password twice below then press the "Change Password"
440 @ button.</p>
441 @ <form action="login" method="post">
@@ -541,11 +541,11 @@
541
542 /*
543 ** This routine examines the login cookie to see if it exists and
544 ** and is valid. If the login cookie checks out, it then sets
545 ** global variables appropriately. Global variables set include
546 ** g.userUid and g.zLogin and of the g.okRead family of permission
547 ** booleans.
548 **
549 */
550 void login_check_credentials(void){
551 int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725 */
726 void login_set_capabilities(const char *zCap, unsigned flags){
727 int i;
728 for(i=0; zCap[i]; i++){
729 switch( zCap[i] ){
730 case 's': g.okSetup = 1; /* Fall thru into Admin */
731 case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
732 g.okRdWiki = g.okWrWiki = g.okNewWiki =
733 g.okApndWiki = g.okHistory = g.okClone =
734 g.okNewTkt = g.okPassword = g.okRdAddr =
735 g.okTktFmt = g.okAttach = g.okApndTkt = 1;
736 /* Fall thru into Read/Write */
737 case 'i': g.okRead = g.okWrite = 1; break;
738 case 'o': g.okRead = 1; break;
739 case 'z': g.okZip = 1; break;
740
741 case 'd': g.okDelete = 1; break;
742 case 'h': g.okHistory = 1; break;
743 case 'g': g.okClone = 1; break;
744 case 'p': g.okPassword = 1; break;
745
746 case 'j': g.okRdWiki = 1; break;
747 case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
748 case 'm': g.okApndWiki = 1; break;
749 case 'f': g.okNewWiki = 1; break;
750
751 case 'e': g.okRdAddr = 1; break;
752 case 'r': g.okRdTkt = 1; break;
753 case 'n': g.okNewTkt = 1; break;
754 case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
755 g.okApndTkt = 1; break;
756 case 'c': g.okApndTkt = 1; break;
757 case 't': g.okTktFmt = 1; break;
758 case 'b': g.okAttach = 1; break;
759 case 'x': g.okPrivate = 1; break;
760
761 /* The "u" privileges is a little different. It recursively
762 ** inherits all privileges of the user named "reader" */
763 case 'u': {
764 if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792 int i;
793 int rc = 1;
794 if( nCap<0 ) nCap = strlen(zCap);
795 for(i=0; i<nCap && rc && zCap[i]; i++){
796 switch( zCap[i] ){
797 case 'a': rc = g.okAdmin; break;
798 case 'b': rc = g.okAttach; break;
799 case 'c': rc = g.okApndTkt; break;
800 case 'd': rc = g.okDelete; break;
801 case 'e': rc = g.okRdAddr; break;
802 case 'f': rc = g.okNewWiki; break;
803 case 'g': rc = g.okClone; break;
804 case 'h': rc = g.okHistory; break;
805 case 'i': rc = g.okWrite; break;
806 case 'j': rc = g.okRdWiki; break;
807 case 'k': rc = g.okWrWiki; break;
808 /* case 'l': */
809 case 'm': rc = g.okApndWiki; break;
810 case 'n': rc = g.okNewTkt; break;
811 case 'o': rc = g.okRead; break;
812 case 'p': rc = g.okPassword; break;
813 /* case 'q': */
814 case 'r': rc = g.okRdTkt; break;
815 case 's': rc = g.okSetup; break;
816 case 't': rc = g.okTktFmt; break;
817 /* case 'u': READER */
818 /* case 'v': DEVELOPER */
819 case 'w': rc = g.okWrTkt; break;
820 case 'x': rc = g.okPrivate; break;
821 /* case 'y': */
822 case 'z': rc = g.okZip; break;
823 default: rc = 0; break;
824 }
825 }
826 return rc;
827 }
@@ -831,32 +831,11 @@
831 */
832 void login_as_user(const char *zUser){
833 char *zCap = ""; /* New capabilities */
834
835 /* Turn off all capabilities from prior logins */
836 g.okSetup = 0;
837 g.okAdmin = 0;
838 g.okDelete = 0;
839 g.okPassword = 0;
840 g.okQuery = 0;
841 g.okWrite = 0;
842 g.okRead = 0;
843 g.okHistory = 0;
844 g.okClone = 0;
845 g.okRdWiki = 0;
846 g.okNewWiki = 0;
847 g.okApndWiki = 0;
848 g.okWrWiki = 0;
849 g.okRdTkt = 0;
850 g.okNewTkt = 0;
851 g.okApndTkt = 0;
852 g.okWrTkt = 0;
853 g.okAttach = 0;
854 g.okTktFmt = 0;
855 g.okRdAddr = 0;
856 g.okZip = 0;
857 g.okPrivate = 0;
858
859 /* Set the global variables recording the userid and login. The
860 ** "nobody" user is a special case in that g.zLogin==0.
861 */
862 g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
892 ** the anonymous user has okHistory permission, then paint a mesage
893 ** to inform the user that much more information is available by
894 ** logging in as anonymous.
895 */
896 void login_anonymous_available(void){
897 if( !g.okHistory &&
898 db_exists("SELECT 1 FROM user"
899 " WHERE login='anonymous'"
900 " AND cap LIKE '%%h%%'") ){
901 const char *zUrl = PD("REQUEST_URI", "index");
902 @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
903
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226 /* To logout, change the cookie value to an empty string */
227 const char *zCookieName = login_cookie_name();
228 cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229 redirect_to_g();
230 }
231 if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232 /* The user requests a password change */
233 zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234 if( db_int(1, "SELECT 0 FROM user"
235 " WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236 g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431 @ <p>To log off the system (and delete your login cookie)
432 @ press the following button:<br />
433 @ <input type="submit" name="out" value="Logout" /></p>
434 }
435 @ </form>
436 if( g.perm.Password ){
437 @ <hr />
438 @ <p>To change your password, enter your old password and your
439 @ new password twice below then press the "Change Password"
440 @ button.</p>
441 @ <form action="login" method="post">
@@ -541,11 +541,11 @@
541
542 /*
543 ** This routine examines the login cookie to see if it exists and
544 ** and is valid. If the login cookie checks out, it then sets
545 ** global variables appropriately. Global variables set include
546 ** g.userUid and g.zLogin and of the g.perm.Read family of permission
547 ** booleans.
548 **
549 */
550 void login_check_credentials(void){
551 int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725 */
726 void login_set_capabilities(const char *zCap, unsigned flags){
727 int i;
728 for(i=0; zCap[i]; i++){
729 switch( zCap[i] ){
730 case 's': g.perm.Setup = 1; /* Fall thru into Admin */
731 case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip =
732 g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki =
733 g.perm.ApndWiki = g.perm.History = g.perm.Clone =
734 g.perm.NewTkt = g.perm.Password = g.perm.RdAddr =
735 g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1;
736 /* Fall thru into Read/Write */
737 case 'i': g.perm.Read = g.perm.Write = 1; break;
738 case 'o': g.perm.Read = 1; break;
739 case 'z': g.perm.Zip = 1; break;
740
741 case 'd': g.perm.Delete = 1; break;
742 case 'h': g.perm.History = 1; break;
743 case 'g': g.perm.Clone = 1; break;
744 case 'p': g.perm.Password = 1; break;
745
746 case 'j': g.perm.RdWiki = 1; break;
747 case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break;
748 case 'm': g.perm.ApndWiki = 1; break;
749 case 'f': g.perm.NewWiki = 1; break;
750
751 case 'e': g.perm.RdAddr = 1; break;
752 case 'r': g.perm.RdTkt = 1; break;
753 case 'n': g.perm.NewTkt = 1; break;
754 case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt =
755 g.perm.ApndTkt = 1; break;
756 case 'c': g.perm.ApndTkt = 1; break;
757 case 't': g.perm.TktFmt = 1; break;
758 case 'b': g.perm.Attach = 1; break;
759 case 'x': g.perm.Private = 1; break;
760
761 /* The "u" privileges is a little different. It recursively
762 ** inherits all privileges of the user named "reader" */
763 case 'u': {
764 if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792 int i;
793 int rc = 1;
794 if( nCap<0 ) nCap = strlen(zCap);
795 for(i=0; i<nCap && rc && zCap[i]; i++){
796 switch( zCap[i] ){
797 case 'a': rc = g.perm.Admin; break;
798 case 'b': rc = g.perm.Attach; break;
799 case 'c': rc = g.perm.ApndTkt; break;
800 case 'd': rc = g.perm.Delete; break;
801 case 'e': rc = g.perm.RdAddr; break;
802 case 'f': rc = g.perm.NewWiki; break;
803 case 'g': rc = g.perm.Clone; break;
804 case 'h': rc = g.perm.History; break;
805 case 'i': rc = g.perm.Write; break;
806 case 'j': rc = g.perm.RdWiki; break;
807 case 'k': rc = g.perm.WrWiki; break;
808 /* case 'l': */
809 case 'm': rc = g.perm.ApndWiki; break;
810 case 'n': rc = g.perm.NewTkt; break;
811 case 'o': rc = g.perm.Read; break;
812 case 'p': rc = g.perm.Password; break;
813 /* case 'q': */
814 case 'r': rc = g.perm.RdTkt; break;
815 case 's': rc = g.perm.Setup; break;
816 case 't': rc = g.perm.TktFmt; break;
817 /* case 'u': READER */
818 /* case 'v': DEVELOPER */
819 case 'w': rc = g.perm.WrTkt; break;
820 case 'x': rc = g.perm.Private; break;
821 /* case 'y': */
822 case 'z': rc = g.perm.Zip; break;
823 default: rc = 0; break;
824 }
825 }
826 return rc;
827 }
@@ -831,32 +831,11 @@
831 */
832 void login_as_user(const char *zUser){
833 char *zCap = ""; /* New capabilities */
834
835 /* Turn off all capabilities from prior logins */
836 memset( &g.perm, 0, sizeof(g.perm) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
838 /* Set the global variables recording the userid and login. The
839 ** "nobody" user is a special case in that g.zLogin==0.
840 */
841 g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
871 ** the anonymous user has okHistory permission, then paint a mesage
872 ** to inform the user that much more information is available by
873 ** logging in as anonymous.
874 */
875 void login_anonymous_available(void){
876 if( !g.perm.History &&
877 db_exists("SELECT 1 FROM user"
878 " WHERE login='anonymous'"
879 " AND cap LIKE '%%h%%'") ){
880 const char *zUrl = PD("REQUEST_URI", "index");
881 @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
882
+57 -36
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
4242
/*
4343
** Maximum number of auxiliary parameters on reports
4444
*/
4545
#define MX_AUX 5
4646
47
+/*
48
+** Holds flags for fossil user permissions.
49
+*/
50
+struct FossilUserPerms {
51
+ char Setup; /* s: use Setup screens on web interface */
52
+ char Admin; /* a: administrative permission */
53
+ char Delete; /* d: delete wiki or tickets */
54
+ char Password; /* p: change password */
55
+ char Query; /* q: create new reports */
56
+ char Write; /* i: xfer inbound. checkin */
57
+ char Read; /* o: xfer outbound. checkout */
58
+ char History; /* h: access historical information. */
59
+ char Clone; /* g: clone */
60
+ char RdWiki; /* j: view wiki via web */
61
+ char NewWiki; /* f: create new wiki via web */
62
+ char ApndWiki; /* m: append to wiki via web */
63
+ char WrWiki; /* k: edit wiki via web */
64
+ char RdTkt; /* r: view tickets via web */
65
+ char NewTkt; /* n: create new tickets */
66
+ char ApndTkt; /* c: append to tickets via the web */
67
+ char WrTkt; /* w: make changes to tickets via web */
68
+ char Attach; /* b: add attachments */
69
+ char TktFmt; /* t: create new ticket report formats */
70
+ char RdAddr; /* e: read email addresses or other private data */
71
+ char Zip; /* z: download zipped artifact via /zip URL */
72
+ char Private; /* x: can send and receive private content */
73
+};
74
+
4775
/*
4876
** All global variables are in this structure.
4977
*/
5078
struct Global {
5179
int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116144
int rcvid; /* The rcvid. 0 if not yet defined. */
117145
char *zIpAddr; /* The remote IP address */
118146
char *zNonce; /* The nonce used for login */
119147
120148
/* permissions used by the server */
121
- int okSetup; /* s: use Setup screens on web interface */
122
- int okAdmin; /* a: administrative permission */
123
- int okDelete; /* d: delete wiki or tickets */
124
- int okPassword; /* p: change password */
125
- int okQuery; /* q: create new reports */
126
- int okWrite; /* i: xfer inbound. checkin */
127
- int okRead; /* o: xfer outbound. checkout */
128
- int okHistory; /* h: access historical information. */
129
- int okClone; /* g: clone */
130
- int okRdWiki; /* j: view wiki via web */
131
- int okNewWiki; /* f: create new wiki via web */
132
- int okApndWiki; /* m: append to wiki via web */
133
- int okWrWiki; /* k: edit wiki via web */
134
- int okRdTkt; /* r: view tickets via web */
135
- int okNewTkt; /* n: create new tickets */
136
- int okApndTkt; /* c: append to tickets via the web */
137
- int okWrTkt; /* w: make changes to tickets via web */
138
- int okAttach; /* b: add attachments */
139
- int okTktFmt; /* t: create new ticket report formats */
140
- int okRdAddr; /* e: read email addresses or other private data */
141
- int okZip; /* z: download zipped artifact via /zip URL */
142
- int okPrivate; /* x: can send and receive private content */
149
+ struct FossilUserPerms perm;
143150
144151
/* For defense against Cross-site Request Forgery attacks */
145152
char zCsrfToken[12]; /* Value of the anti-CSRF token */
146153
int okCsrf; /* Anti-CSRF token is present and valid */
147154
@@ -1008,11 +1015,11 @@
10081015
file_simplify_name(zAltRepo, -1);
10091016
}
10101017
db_close(1);
10111018
db_open_repository(zAltRepo);
10121019
login_as_user(zUser);
1013
- g.okPassword = 0;
1020
+ g.perm.Password = 0;
10141021
zPath += i;
10151022
nHost = g.zTop - g.zBaseURL;
10161023
g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
10171024
g.zTop = g.zBaseURL + nHost;
10181025
continue;
@@ -1066,10 +1073,12 @@
10661073
** repository: /home/somebody/project.db
10671074
**
10681075
** The second line defines the name of the repository. After locating
10691076
** the repository, fossil will generate a webpage on stdout based on
10701077
** the values of standard CGI environment variables.
1078
+**
1079
+** See also: http, server, winsrv
10711080
*/
10721081
void cmd_cgi(void){
10731082
const char *zFile;
10741083
const char *zNotFound = 0;
10751084
char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
12391248
**
12401249
** The argv==6 form is used by the win32 server only.
12411250
**
12421251
** COMMAND: http
12431252
**
1244
-** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
1253
+** Usage: %fossil http REPOSITORY ?OPTIONS?
12451254
**
12461255
** Handle a single HTTP request appearing on stdin. The resulting webpage
12471256
** is delivered on stdout. This method is used to launch an HTTP request
12481257
** handler from inetd, for example. The argument is the name of the
12491258
** repository.
@@ -1254,20 +1263,25 @@
12541263
** not select a valid repository and the --notfound option is available,
12551264
** then the server redirects (HTTP code 302) to the URL of --notfound.
12561265
**
12571266
** The --host option can be used to specify the hostname for the server.
12581267
** The --https option indicates that the request came from HTTPS rather
1259
-** than HTTP.
1260
-**
1261
-** Other options:
1262
-**
1263
-** --localauth Password signin is not required if this is true and
1264
-** the input comes from 127.0.0.1 and the "localauth"
1265
-** setting is not disabled.
1266
-**
1267
-** --nossl SSL connections are not available so do not
1268
-** redirect from http: to https:.
1268
+** than HTTP. If --nossl is given, then SSL connections will not be available,
1269
+** thus also no redirecting from http: to https: will take place.
1270
+**
1271
+** If the --localauth option is given, then automatic login is performed
1272
+** for requests coming from localhost, if the "localauth" setting is not
1273
+** enabled.
1274
+**
1275
+** Options:
1276
+** --localauth enable automatic login for local connections
1277
+** --host NAME specify hostname of the server
1278
+** --https signal a request coming in via https
1279
+** --nossl signal that no SSL connections are available
1280
+** --notfound URL use URL as "HTTP 404, object not found" page.
1281
+**
1282
+** See also: cgi, server, winsrv
12691283
*/
12701284
void cmd_http(void){
12711285
const char *zIpAddr;
12721286
const char *zNotFound;
12731287
const char *zHost;
@@ -1341,12 +1355,12 @@
13411355
13421356
/*
13431357
** COMMAND: server
13441358
** COMMAND: ui
13451359
**
1346
-** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
1347
-** Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
1360
+** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
1361
+** Or: %fossil ui ?OPTIONS? ?REPOSITORY?
13481362
**
13491363
** Open a socket and begin listening and responding to HTTP requests on
13501364
** TCP port 8080, or on any other TCP port defined by the -P or
13511365
** --port option. The optional argument is the name of the repository.
13521366
** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
13641378
** By default, the "ui" command provides full administrative access without
13651379
** having to log in. This can be disabled by setting turning off the
13661380
** "localauth" setting. Automatic login for the "server" command is available
13671381
** if the --localauth option is present and the "localauth" setting is off
13681382
** and the connection is from localhost.
1383
+**
1384
+** Options:
1385
+** --localauth enable automatic login for requests from localhost
1386
+** -P|--port TCPPORT listen to request on port TCPPORT
1387
+** --th-trace trace TH1 execution (for debugging purposes)
1388
+**
1389
+** See also: cgi, http, winsrv
13691390
*/
13701391
void cmd_webserver(void){
13711392
int iPort, mxPort; /* Range of TCP ports allowed */
13721393
const char *zPort; /* Value of the --port option */
13731394
char *zBrowser; /* Name of web browser program */
13741395
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47 /*
48 ** All global variables are in this structure.
49 */
50 struct Global {
51 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116 int rcvid; /* The rcvid. 0 if not yet defined. */
117 char *zIpAddr; /* The remote IP address */
118 char *zNonce; /* The nonce used for login */
119
120 /* permissions used by the server */
121 int okSetup; /* s: use Setup screens on web interface */
122 int okAdmin; /* a: administrative permission */
123 int okDelete; /* d: delete wiki or tickets */
124 int okPassword; /* p: change password */
125 int okQuery; /* q: create new reports */
126 int okWrite; /* i: xfer inbound. checkin */
127 int okRead; /* o: xfer outbound. checkout */
128 int okHistory; /* h: access historical information. */
129 int okClone; /* g: clone */
130 int okRdWiki; /* j: view wiki via web */
131 int okNewWiki; /* f: create new wiki via web */
132 int okApndWiki; /* m: append to wiki via web */
133 int okWrWiki; /* k: edit wiki via web */
134 int okRdTkt; /* r: view tickets via web */
135 int okNewTkt; /* n: create new tickets */
136 int okApndTkt; /* c: append to tickets via the web */
137 int okWrTkt; /* w: make changes to tickets via web */
138 int okAttach; /* b: add attachments */
139 int okTktFmt; /* t: create new ticket report formats */
140 int okRdAddr; /* e: read email addresses or other private data */
141 int okZip; /* z: download zipped artifact via /zip URL */
142 int okPrivate; /* x: can send and receive private content */
143
144 /* For defense against Cross-site Request Forgery attacks */
145 char zCsrfToken[12]; /* Value of the anti-CSRF token */
146 int okCsrf; /* Anti-CSRF token is present and valid */
147
@@ -1008,11 +1015,11 @@
1008 file_simplify_name(zAltRepo, -1);
1009 }
1010 db_close(1);
1011 db_open_repository(zAltRepo);
1012 login_as_user(zUser);
1013 g.okPassword = 0;
1014 zPath += i;
1015 nHost = g.zTop - g.zBaseURL;
1016 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1017 g.zTop = g.zBaseURL + nHost;
1018 continue;
@@ -1066,10 +1073,12 @@
1066 ** repository: /home/somebody/project.db
1067 **
1068 ** The second line defines the name of the repository. After locating
1069 ** the repository, fossil will generate a webpage on stdout based on
1070 ** the values of standard CGI environment variables.
 
 
1071 */
1072 void cmd_cgi(void){
1073 const char *zFile;
1074 const char *zNotFound = 0;
1075 char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
1239 **
1240 ** The argv==6 form is used by the win32 server only.
1241 **
1242 ** COMMAND: http
1243 **
1244 ** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
1245 **
1246 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1247 ** is delivered on stdout. This method is used to launch an HTTP request
1248 ** handler from inetd, for example. The argument is the name of the
1249 ** repository.
@@ -1254,20 +1263,25 @@
1254 ** not select a valid repository and the --notfound option is available,
1255 ** then the server redirects (HTTP code 302) to the URL of --notfound.
1256 **
1257 ** The --host option can be used to specify the hostname for the server.
1258 ** The --https option indicates that the request came from HTTPS rather
1259 ** than HTTP.
1260 **
1261 ** Other options:
1262 **
1263 ** --localauth Password signin is not required if this is true and
1264 ** the input comes from 127.0.0.1 and the "localauth"
1265 ** setting is not disabled.
1266 **
1267 ** --nossl SSL connections are not available so do not
1268 ** redirect from http: to https:.
 
 
 
 
 
1269 */
1270 void cmd_http(void){
1271 const char *zIpAddr;
1272 const char *zNotFound;
1273 const char *zHost;
@@ -1341,12 +1355,12 @@
1341
1342 /*
1343 ** COMMAND: server
1344 ** COMMAND: ui
1345 **
1346 ** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
1347 ** Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
1348 **
1349 ** Open a socket and begin listening and responding to HTTP requests on
1350 ** TCP port 8080, or on any other TCP port defined by the -P or
1351 ** --port option. The optional argument is the name of the repository.
1352 ** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
1364 ** By default, the "ui" command provides full administrative access without
1365 ** having to log in. This can be disabled by setting turning off the
1366 ** "localauth" setting. Automatic login for the "server" command is available
1367 ** if the --localauth option is present and the "localauth" setting is off
1368 ** and the connection is from localhost.
 
 
 
 
 
 
 
1369 */
1370 void cmd_webserver(void){
1371 int iPort, mxPort; /* Range of TCP ports allowed */
1372 const char *zPort; /* Value of the --port option */
1373 char *zBrowser; /* Name of web browser program */
1374
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
47 /*
48 ** Holds flags for fossil user permissions.
49 */
50 struct FossilUserPerms {
51 char Setup; /* s: use Setup screens on web interface */
52 char Admin; /* a: administrative permission */
53 char Delete; /* d: delete wiki or tickets */
54 char Password; /* p: change password */
55 char Query; /* q: create new reports */
56 char Write; /* i: xfer inbound. checkin */
57 char Read; /* o: xfer outbound. checkout */
58 char History; /* h: access historical information. */
59 char Clone; /* g: clone */
60 char RdWiki; /* j: view wiki via web */
61 char NewWiki; /* f: create new wiki via web */
62 char ApndWiki; /* m: append to wiki via web */
63 char WrWiki; /* k: edit wiki via web */
64 char RdTkt; /* r: view tickets via web */
65 char NewTkt; /* n: create new tickets */
66 char ApndTkt; /* c: append to tickets via the web */
67 char WrTkt; /* w: make changes to tickets via web */
68 char Attach; /* b: add attachments */
69 char TktFmt; /* t: create new ticket report formats */
70 char RdAddr; /* e: read email addresses or other private data */
71 char Zip; /* z: download zipped artifact via /zip URL */
72 char Private; /* x: can send and receive private content */
73 };
74
75 /*
76 ** All global variables are in this structure.
77 */
78 struct Global {
79 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
144 int rcvid; /* The rcvid. 0 if not yet defined. */
145 char *zIpAddr; /* The remote IP address */
146 char *zNonce; /* The nonce used for login */
147
148 /* permissions used by the server */
149 struct FossilUserPerms perm;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
151 /* For defense against Cross-site Request Forgery attacks */
152 char zCsrfToken[12]; /* Value of the anti-CSRF token */
153 int okCsrf; /* Anti-CSRF token is present and valid */
154
@@ -1008,11 +1015,11 @@
1015 file_simplify_name(zAltRepo, -1);
1016 }
1017 db_close(1);
1018 db_open_repository(zAltRepo);
1019 login_as_user(zUser);
1020 g.perm.Password = 0;
1021 zPath += i;
1022 nHost = g.zTop - g.zBaseURL;
1023 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1024 g.zTop = g.zBaseURL + nHost;
1025 continue;
@@ -1066,10 +1073,12 @@
1073 ** repository: /home/somebody/project.db
1074 **
1075 ** The second line defines the name of the repository. After locating
1076 ** the repository, fossil will generate a webpage on stdout based on
1077 ** the values of standard CGI environment variables.
1078 **
1079 ** See also: http, server, winsrv
1080 */
1081 void cmd_cgi(void){
1082 const char *zFile;
1083 const char *zNotFound = 0;
1084 char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
1248 **
1249 ** The argv==6 form is used by the win32 server only.
1250 **
1251 ** COMMAND: http
1252 **
1253 ** Usage: %fossil http REPOSITORY ?OPTIONS?
1254 **
1255 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1256 ** is delivered on stdout. This method is used to launch an HTTP request
1257 ** handler from inetd, for example. The argument is the name of the
1258 ** repository.
@@ -1254,20 +1263,25 @@
1263 ** not select a valid repository and the --notfound option is available,
1264 ** then the server redirects (HTTP code 302) to the URL of --notfound.
1265 **
1266 ** The --host option can be used to specify the hostname for the server.
1267 ** The --https option indicates that the request came from HTTPS rather
1268 ** than HTTP. If --nossl is given, then SSL connections will not be available,
1269 ** thus also no redirecting from http: to https: will take place.
1270 **
1271 ** If the --localauth option is given, then automatic login is performed
1272 ** for requests coming from localhost, if the "localauth" setting is not
1273 ** enabled.
1274 **
1275 ** Options:
1276 ** --localauth enable automatic login for local connections
1277 ** --host NAME specify hostname of the server
1278 ** --https signal a request coming in via https
1279 ** --nossl signal that no SSL connections are available
1280 ** --notfound URL use URL as "HTTP 404, object not found" page.
1281 **
1282 ** See also: cgi, server, winsrv
1283 */
1284 void cmd_http(void){
1285 const char *zIpAddr;
1286 const char *zNotFound;
1287 const char *zHost;
@@ -1341,12 +1355,12 @@
1355
1356 /*
1357 ** COMMAND: server
1358 ** COMMAND: ui
1359 **
1360 ** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
1361 ** Or: %fossil ui ?OPTIONS? ?REPOSITORY?
1362 **
1363 ** Open a socket and begin listening and responding to HTTP requests on
1364 ** TCP port 8080, or on any other TCP port defined by the -P or
1365 ** --port option. The optional argument is the name of the repository.
1366 ** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
1378 ** By default, the "ui" command provides full administrative access without
1379 ** having to log in. This can be disabled by setting turning off the
1380 ** "localauth" setting. Automatic login for the "server" command is available
1381 ** if the --localauth option is present and the "localauth" setting is off
1382 ** and the connection is from localhost.
1383 **
1384 ** Options:
1385 ** --localauth enable automatic login for requests from localhost
1386 ** -P|--port TCPPORT listen to request on port TCPPORT
1387 ** --th-trace trace TH1 execution (for debugging purposes)
1388 **
1389 ** See also: cgi, http, winsrv
1390 */
1391 void cmd_webserver(void){
1392 int iPort, mxPort; /* Range of TCP ports allowed */
1393 const char *zPort; /* Value of the --port option */
1394 char *zBrowser; /* Name of web browser program */
1395
+57 -36
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
4242
/*
4343
** Maximum number of auxiliary parameters on reports
4444
*/
4545
#define MX_AUX 5
4646
47
+/*
48
+** Holds flags for fossil user permissions.
49
+*/
50
+struct FossilUserPerms {
51
+ char Setup; /* s: use Setup screens on web interface */
52
+ char Admin; /* a: administrative permission */
53
+ char Delete; /* d: delete wiki or tickets */
54
+ char Password; /* p: change password */
55
+ char Query; /* q: create new reports */
56
+ char Write; /* i: xfer inbound. checkin */
57
+ char Read; /* o: xfer outbound. checkout */
58
+ char History; /* h: access historical information. */
59
+ char Clone; /* g: clone */
60
+ char RdWiki; /* j: view wiki via web */
61
+ char NewWiki; /* f: create new wiki via web */
62
+ char ApndWiki; /* m: append to wiki via web */
63
+ char WrWiki; /* k: edit wiki via web */
64
+ char RdTkt; /* r: view tickets via web */
65
+ char NewTkt; /* n: create new tickets */
66
+ char ApndTkt; /* c: append to tickets via the web */
67
+ char WrTkt; /* w: make changes to tickets via web */
68
+ char Attach; /* b: add attachments */
69
+ char TktFmt; /* t: create new ticket report formats */
70
+ char RdAddr; /* e: read email addresses or other private data */
71
+ char Zip; /* z: download zipped artifact via /zip URL */
72
+ char Private; /* x: can send and receive private content */
73
+};
74
+
4775
/*
4876
** All global variables are in this structure.
4977
*/
5078
struct Global {
5179
int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116144
int rcvid; /* The rcvid. 0 if not yet defined. */
117145
char *zIpAddr; /* The remote IP address */
118146
char *zNonce; /* The nonce used for login */
119147
120148
/* permissions used by the server */
121
- int okSetup; /* s: use Setup screens on web interface */
122
- int okAdmin; /* a: administrative permission */
123
- int okDelete; /* d: delete wiki or tickets */
124
- int okPassword; /* p: change password */
125
- int okQuery; /* q: create new reports */
126
- int okWrite; /* i: xfer inbound. checkin */
127
- int okRead; /* o: xfer outbound. checkout */
128
- int okHistory; /* h: access historical information. */
129
- int okClone; /* g: clone */
130
- int okRdWiki; /* j: view wiki via web */
131
- int okNewWiki; /* f: create new wiki via web */
132
- int okApndWiki; /* m: append to wiki via web */
133
- int okWrWiki; /* k: edit wiki via web */
134
- int okRdTkt; /* r: view tickets via web */
135
- int okNewTkt; /* n: create new tickets */
136
- int okApndTkt; /* c: append to tickets via the web */
137
- int okWrTkt; /* w: make changes to tickets via web */
138
- int okAttach; /* b: add attachments */
139
- int okTktFmt; /* t: create new ticket report formats */
140
- int okRdAddr; /* e: read email addresses or other private data */
141
- int okZip; /* z: download zipped artifact via /zip URL */
142
- int okPrivate; /* x: can send and receive private content */
149
+ struct FossilUserPerms perm;
143150
144151
/* For defense against Cross-site Request Forgery attacks */
145152
char zCsrfToken[12]; /* Value of the anti-CSRF token */
146153
int okCsrf; /* Anti-CSRF token is present and valid */
147154
@@ -1008,11 +1015,11 @@
10081015
file_simplify_name(zAltRepo, -1);
10091016
}
10101017
db_close(1);
10111018
db_open_repository(zAltRepo);
10121019
login_as_user(zUser);
1013
- g.okPassword = 0;
1020
+ g.perm.Password = 0;
10141021
zPath += i;
10151022
nHost = g.zTop - g.zBaseURL;
10161023
g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
10171024
g.zTop = g.zBaseURL + nHost;
10181025
continue;
@@ -1066,10 +1073,12 @@
10661073
** repository: /home/somebody/project.db
10671074
**
10681075
** The second line defines the name of the repository. After locating
10691076
** the repository, fossil will generate a webpage on stdout based on
10701077
** the values of standard CGI environment variables.
1078
+**
1079
+** See also: http, server, winsrv
10711080
*/
10721081
void cmd_cgi(void){
10731082
const char *zFile;
10741083
const char *zNotFound = 0;
10751084
char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
12391248
**
12401249
** The argv==6 form is used by the win32 server only.
12411250
**
12421251
** COMMAND: http
12431252
**
1244
-** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
1253
+** Usage: %fossil http REPOSITORY ?OPTIONS?
12451254
**
12461255
** Handle a single HTTP request appearing on stdin. The resulting webpage
12471256
** is delivered on stdout. This method is used to launch an HTTP request
12481257
** handler from inetd, for example. The argument is the name of the
12491258
** repository.
@@ -1254,20 +1263,25 @@
12541263
** not select a valid repository and the --notfound option is available,
12551264
** then the server redirects (HTTP code 302) to the URL of --notfound.
12561265
**
12571266
** The --host option can be used to specify the hostname for the server.
12581267
** The --https option indicates that the request came from HTTPS rather
1259
-** than HTTP.
1260
-**
1261
-** Other options:
1262
-**
1263
-** --localauth Password signin is not required if this is true and
1264
-** the input comes from 127.0.0.1 and the "localauth"
1265
-** setting is not disabled.
1266
-**
1267
-** --nossl SSL connections are not available so do not
1268
-** redirect from http: to https:.
1268
+** than HTTP. If --nossl is given, then SSL connections will not be available,
1269
+** thus also no redirecting from http: to https: will take place.
1270
+**
1271
+** If the --localauth option is given, then automatic login is performed
1272
+** for requests coming from localhost, if the "localauth" setting is not
1273
+** enabled.
1274
+**
1275
+** Options:
1276
+** --localauth enable automatic login for local connections
1277
+** --host NAME specify hostname of the server
1278
+** --https signal a request coming in via https
1279
+** --nossl signal that no SSL connections are available
1280
+** --notfound URL use URL as "HTTP 404, object not found" page.
1281
+**
1282
+** See also: cgi, server, winsrv
12691283
*/
12701284
void cmd_http(void){
12711285
const char *zIpAddr;
12721286
const char *zNotFound;
12731287
const char *zHost;
@@ -1341,12 +1355,12 @@
13411355
13421356
/*
13431357
** COMMAND: server
13441358
** COMMAND: ui
13451359
**
1346
-** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
1347
-** Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
1360
+** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
1361
+** Or: %fossil ui ?OPTIONS? ?REPOSITORY?
13481362
**
13491363
** Open a socket and begin listening and responding to HTTP requests on
13501364
** TCP port 8080, or on any other TCP port defined by the -P or
13511365
** --port option. The optional argument is the name of the repository.
13521366
** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
13641378
** By default, the "ui" command provides full administrative access without
13651379
** having to log in. This can be disabled by setting turning off the
13661380
** "localauth" setting. Automatic login for the "server" command is available
13671381
** if the --localauth option is present and the "localauth" setting is off
13681382
** and the connection is from localhost.
1383
+**
1384
+** Options:
1385
+** --localauth enable automatic login for requests from localhost
1386
+** -P|--port TCPPORT listen to request on port TCPPORT
1387
+** --th-trace trace TH1 execution (for debugging purposes)
1388
+**
1389
+** See also: cgi, http, winsrv
13691390
*/
13701391
void cmd_webserver(void){
13711392
int iPort, mxPort; /* Range of TCP ports allowed */
13721393
const char *zPort; /* Value of the --port option */
13731394
char *zBrowser; /* Name of web browser program */
13741395
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47 /*
48 ** All global variables are in this structure.
49 */
50 struct Global {
51 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116 int rcvid; /* The rcvid. 0 if not yet defined. */
117 char *zIpAddr; /* The remote IP address */
118 char *zNonce; /* The nonce used for login */
119
120 /* permissions used by the server */
121 int okSetup; /* s: use Setup screens on web interface */
122 int okAdmin; /* a: administrative permission */
123 int okDelete; /* d: delete wiki or tickets */
124 int okPassword; /* p: change password */
125 int okQuery; /* q: create new reports */
126 int okWrite; /* i: xfer inbound. checkin */
127 int okRead; /* o: xfer outbound. checkout */
128 int okHistory; /* h: access historical information. */
129 int okClone; /* g: clone */
130 int okRdWiki; /* j: view wiki via web */
131 int okNewWiki; /* f: create new wiki via web */
132 int okApndWiki; /* m: append to wiki via web */
133 int okWrWiki; /* k: edit wiki via web */
134 int okRdTkt; /* r: view tickets via web */
135 int okNewTkt; /* n: create new tickets */
136 int okApndTkt; /* c: append to tickets via the web */
137 int okWrTkt; /* w: make changes to tickets via web */
138 int okAttach; /* b: add attachments */
139 int okTktFmt; /* t: create new ticket report formats */
140 int okRdAddr; /* e: read email addresses or other private data */
141 int okZip; /* z: download zipped artifact via /zip URL */
142 int okPrivate; /* x: can send and receive private content */
143
144 /* For defense against Cross-site Request Forgery attacks */
145 char zCsrfToken[12]; /* Value of the anti-CSRF token */
146 int okCsrf; /* Anti-CSRF token is present and valid */
147
@@ -1008,11 +1015,11 @@
1008 file_simplify_name(zAltRepo, -1);
1009 }
1010 db_close(1);
1011 db_open_repository(zAltRepo);
1012 login_as_user(zUser);
1013 g.okPassword = 0;
1014 zPath += i;
1015 nHost = g.zTop - g.zBaseURL;
1016 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1017 g.zTop = g.zBaseURL + nHost;
1018 continue;
@@ -1066,10 +1073,12 @@
1066 ** repository: /home/somebody/project.db
1067 **
1068 ** The second line defines the name of the repository. After locating
1069 ** the repository, fossil will generate a webpage on stdout based on
1070 ** the values of standard CGI environment variables.
 
 
1071 */
1072 void cmd_cgi(void){
1073 const char *zFile;
1074 const char *zNotFound = 0;
1075 char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
1239 **
1240 ** The argv==6 form is used by the win32 server only.
1241 **
1242 ** COMMAND: http
1243 **
1244 ** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
1245 **
1246 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1247 ** is delivered on stdout. This method is used to launch an HTTP request
1248 ** handler from inetd, for example. The argument is the name of the
1249 ** repository.
@@ -1254,20 +1263,25 @@
1254 ** not select a valid repository and the --notfound option is available,
1255 ** then the server redirects (HTTP code 302) to the URL of --notfound.
1256 **
1257 ** The --host option can be used to specify the hostname for the server.
1258 ** The --https option indicates that the request came from HTTPS rather
1259 ** than HTTP.
1260 **
1261 ** Other options:
1262 **
1263 ** --localauth Password signin is not required if this is true and
1264 ** the input comes from 127.0.0.1 and the "localauth"
1265 ** setting is not disabled.
1266 **
1267 ** --nossl SSL connections are not available so do not
1268 ** redirect from http: to https:.
 
 
 
 
 
1269 */
1270 void cmd_http(void){
1271 const char *zIpAddr;
1272 const char *zNotFound;
1273 const char *zHost;
@@ -1341,12 +1355,12 @@
1341
1342 /*
1343 ** COMMAND: server
1344 ** COMMAND: ui
1345 **
1346 ** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
1347 ** Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
1348 **
1349 ** Open a socket and begin listening and responding to HTTP requests on
1350 ** TCP port 8080, or on any other TCP port defined by the -P or
1351 ** --port option. The optional argument is the name of the repository.
1352 ** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
1364 ** By default, the "ui" command provides full administrative access without
1365 ** having to log in. This can be disabled by setting turning off the
1366 ** "localauth" setting. Automatic login for the "server" command is available
1367 ** if the --localauth option is present and the "localauth" setting is off
1368 ** and the connection is from localhost.
 
 
 
 
 
 
 
1369 */
1370 void cmd_webserver(void){
1371 int iPort, mxPort; /* Range of TCP ports allowed */
1372 const char *zPort; /* Value of the --port option */
1373 char *zBrowser; /* Name of web browser program */
1374
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
47 /*
48 ** Holds flags for fossil user permissions.
49 */
50 struct FossilUserPerms {
51 char Setup; /* s: use Setup screens on web interface */
52 char Admin; /* a: administrative permission */
53 char Delete; /* d: delete wiki or tickets */
54 char Password; /* p: change password */
55 char Query; /* q: create new reports */
56 char Write; /* i: xfer inbound. checkin */
57 char Read; /* o: xfer outbound. checkout */
58 char History; /* h: access historical information. */
59 char Clone; /* g: clone */
60 char RdWiki; /* j: view wiki via web */
61 char NewWiki; /* f: create new wiki via web */
62 char ApndWiki; /* m: append to wiki via web */
63 char WrWiki; /* k: edit wiki via web */
64 char RdTkt; /* r: view tickets via web */
65 char NewTkt; /* n: create new tickets */
66 char ApndTkt; /* c: append to tickets via the web */
67 char WrTkt; /* w: make changes to tickets via web */
68 char Attach; /* b: add attachments */
69 char TktFmt; /* t: create new ticket report formats */
70 char RdAddr; /* e: read email addresses or other private data */
71 char Zip; /* z: download zipped artifact via /zip URL */
72 char Private; /* x: can send and receive private content */
73 };
74
75 /*
76 ** All global variables are in this structure.
77 */
78 struct Global {
79 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
144 int rcvid; /* The rcvid. 0 if not yet defined. */
145 char *zIpAddr; /* The remote IP address */
146 char *zNonce; /* The nonce used for login */
147
148 /* permissions used by the server */
149 struct FossilUserPerms perm;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
151 /* For defense against Cross-site Request Forgery attacks */
152 char zCsrfToken[12]; /* Value of the anti-CSRF token */
153 int okCsrf; /* Anti-CSRF token is present and valid */
154
@@ -1008,11 +1015,11 @@
1015 file_simplify_name(zAltRepo, -1);
1016 }
1017 db_close(1);
1018 db_open_repository(zAltRepo);
1019 login_as_user(zUser);
1020 g.perm.Password = 0;
1021 zPath += i;
1022 nHost = g.zTop - g.zBaseURL;
1023 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1024 g.zTop = g.zBaseURL + nHost;
1025 continue;
@@ -1066,10 +1073,12 @@
1073 ** repository: /home/somebody/project.db
1074 **
1075 ** The second line defines the name of the repository. After locating
1076 ** the repository, fossil will generate a webpage on stdout based on
1077 ** the values of standard CGI environment variables.
1078 **
1079 ** See also: http, server, winsrv
1080 */
1081 void cmd_cgi(void){
1082 const char *zFile;
1083 const char *zNotFound = 0;
1084 char **azRedirect = 0; /* List of repositories to redirect to */
@@ -1239,11 +1248,11 @@
1248 **
1249 ** The argv==6 form is used by the win32 server only.
1250 **
1251 ** COMMAND: http
1252 **
1253 ** Usage: %fossil http REPOSITORY ?OPTIONS?
1254 **
1255 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1256 ** is delivered on stdout. This method is used to launch an HTTP request
1257 ** handler from inetd, for example. The argument is the name of the
1258 ** repository.
@@ -1254,20 +1263,25 @@
1263 ** not select a valid repository and the --notfound option is available,
1264 ** then the server redirects (HTTP code 302) to the URL of --notfound.
1265 **
1266 ** The --host option can be used to specify the hostname for the server.
1267 ** The --https option indicates that the request came from HTTPS rather
1268 ** than HTTP. If --nossl is given, then SSL connections will not be available,
1269 ** thus also no redirecting from http: to https: will take place.
1270 **
1271 ** If the --localauth option is given, then automatic login is performed
1272 ** for requests coming from localhost, if the "localauth" setting is not
1273 ** enabled.
1274 **
1275 ** Options:
1276 ** --localauth enable automatic login for local connections
1277 ** --host NAME specify hostname of the server
1278 ** --https signal a request coming in via https
1279 ** --nossl signal that no SSL connections are available
1280 ** --notfound URL use URL as "HTTP 404, object not found" page.
1281 **
1282 ** See also: cgi, server, winsrv
1283 */
1284 void cmd_http(void){
1285 const char *zIpAddr;
1286 const char *zNotFound;
1287 const char *zHost;
@@ -1341,12 +1355,12 @@
1355
1356 /*
1357 ** COMMAND: server
1358 ** COMMAND: ui
1359 **
1360 ** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
1361 ** Or: %fossil ui ?OPTIONS? ?REPOSITORY?
1362 **
1363 ** Open a socket and begin listening and responding to HTTP requests on
1364 ** TCP port 8080, or on any other TCP port defined by the -P or
1365 ** --port option. The optional argument is the name of the repository.
1366 ** The repository argument may be omitted if the working directory is
@@ -1364,10 +1378,17 @@
1378 ** By default, the "ui" command provides full administrative access without
1379 ** having to log in. This can be disabled by setting turning off the
1380 ** "localauth" setting. Automatic login for the "server" command is available
1381 ** if the --localauth option is present and the "localauth" setting is off
1382 ** and the connection is from localhost.
1383 **
1384 ** Options:
1385 ** --localauth enable automatic login for requests from localhost
1386 ** -P|--port TCPPORT listen to request on port TCPPORT
1387 ** --th-trace trace TH1 execution (for debugging purposes)
1388 **
1389 ** See also: cgi, http, winsrv
1390 */
1391 void cmd_webserver(void){
1392 int iPort, mxPort; /* Range of TCP ports allowed */
1393 const char *zPort; /* Value of the --port option */
1394 char *zBrowser; /* Name of web browser program */
1395
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705705
** is added, then private branches, concealed email addresses, IP
706706
** addresses of correspondents, and similar privacy-sensitive fields
707707
** are also purged. If the --private option is used, then only private
708708
** branches are removed and all other information is left intact.
709709
**
710
-** This command permanently deletes the scrubbed information. The effects
711
-** of this command are irreversible. Use with caution.
710
+** This command permanently deletes the scrubbed information. THE EFFECTS
711
+** OF THIS COMMAND ARE IRREVERSIBLE. USE WITH CAUTION!
712712
**
713713
** The user is prompted to confirm the scrub unless the --force option
714714
** is used.
715715
**
716716
** Options:
717717
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705 ** is added, then private branches, concealed email addresses, IP
706 ** addresses of correspondents, and similar privacy-sensitive fields
707 ** are also purged. If the --private option is used, then only private
708 ** branches are removed and all other information is left intact.
709 **
710 ** This command permanently deletes the scrubbed information. The effects
711 ** of this command are irreversible. Use with caution.
712 **
713 ** The user is prompted to confirm the scrub unless the --force option
714 ** is used.
715 **
716 ** Options:
717
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705 ** is added, then private branches, concealed email addresses, IP
706 ** addresses of correspondents, and similar privacy-sensitive fields
707 ** are also purged. If the --private option is used, then only private
708 ** branches are removed and all other information is left intact.
709 **
710 ** This command permanently deletes the scrubbed information. THE EFFECTS
711 ** OF THIS COMMAND ARE IRREVERSIBLE. USE WITH CAUTION!
712 **
713 ** The user is prompted to confirm the scrub unless the --force option
714 ** is used.
715 **
716 ** Options:
717
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705705
** is added, then private branches, concealed email addresses, IP
706706
** addresses of correspondents, and similar privacy-sensitive fields
707707
** are also purged. If the --private option is used, then only private
708708
** branches are removed and all other information is left intact.
709709
**
710
-** This command permanently deletes the scrubbed information. The effects
711
-** of this command are irreversible. Use with caution.
710
+** This command permanently deletes the scrubbed information. THE EFFECTS
711
+** OF THIS COMMAND ARE IRREVERSIBLE. USE WITH CAUTION!
712712
**
713713
** The user is prompted to confirm the scrub unless the --force option
714714
** is used.
715715
**
716716
** Options:
717717
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705 ** is added, then private branches, concealed email addresses, IP
706 ** addresses of correspondents, and similar privacy-sensitive fields
707 ** are also purged. If the --private option is used, then only private
708 ** branches are removed and all other information is left intact.
709 **
710 ** This command permanently deletes the scrubbed information. The effects
711 ** of this command are irreversible. Use with caution.
712 **
713 ** The user is prompted to confirm the scrub unless the --force option
714 ** is used.
715 **
716 ** Options:
717
--- src/rebuild.c
+++ src/rebuild.c
@@ -705,12 +705,12 @@
705 ** is added, then private branches, concealed email addresses, IP
706 ** addresses of correspondents, and similar privacy-sensitive fields
707 ** are also purged. If the --private option is used, then only private
708 ** branches are removed and all other information is left intact.
709 **
710 ** This command permanently deletes the scrubbed information. THE EFFECTS
711 ** OF THIS COMMAND ARE IRREVERSIBLE. USE WITH CAUTION!
712 **
713 ** The user is prompted to confirm the scrub unless the --force option
714 ** is used.
715 **
716 ** Options:
717
+23 -23
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
3434
Stmt q;
3535
int rn = 0;
3636
int cnt = 0;
3737
3838
login_check_credentials();
39
- if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
39
+ if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; }
4040
style_header("Ticket Main Menu");
4141
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
4242
zScript = ticket_reportlist_code();
4343
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
4444
@@ -47,11 +47,11 @@
4747
4848
db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
4949
while( db_step(&q)==SQLITE_ROW ){
5050
const char *zTitle = db_column_text(&q, 1);
5151
const char *zOwner = db_column_text(&q, 2);
52
- if( zTitle[0] =='_' && !g.okTktFmt ){
52
+ if( zTitle[0] =='_' && !g.perm.TktFmt ){
5353
continue;
5454
}
5555
rn = db_column_int(&q, 0);
5656
cnt++;
5757
blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
5959
blob_appendf(&ril, "%s", zTitle);
6060
} else {
6161
blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
6262
}
6363
blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64
- if( g.okWrite && zOwner && zOwner[0] ){
64
+ if( g.perm.Write && zOwner && zOwner[0] ){
6565
blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
6666
}
67
- if( g.okTktFmt ){
67
+ if( g.perm.TktFmt ){
6868
blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
6969
}
70
- if( g.okAdmin
71
- || (g.okWrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
70
+ if( g.perm.Admin
71
+ || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
7272
){
7373
blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
7474
}
75
- if( g.okTktFmt ){
75
+ if( g.perm.TktFmt ){
7676
blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
7777
}
7878
blob_appendf(&ril, "</li>\n");
7979
}
8080
@@ -184,11 +184,11 @@
184184
if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185185
}
186186
if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187187
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188188
rc = SQLITE_DENY;
189
- }else if( !g.okRdAddr && strncmp(zArg2, "private_", 8)==0 ){
189
+ }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
190190
rc = SQLITE_IGNORE;
191191
}
192192
break;
193193
}
194194
default: {
@@ -275,11 +275,11 @@
275275
const char *zOwner;
276276
const char *zClrKey;
277277
Stmt q;
278278
279279
login_check_credentials();
280
- if( !g.okTktFmt ){
280
+ if( !g.perm.TktFmt ){
281281
login_needed();
282282
return;
283283
}
284284
rn = atoi(PD("rn","0"));
285285
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323323
const char *zClrKey;
324324
char *zSQL;
325325
char *zErr = 0;
326326
327327
login_check_credentials();
328
- if( !g.okTktFmt ){
328
+ if( !g.perm.TktFmt ){
329329
login_needed();
330330
return;
331331
}
332332
/*view_add_functions(0);*/
333333
rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430430
@ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431431
@ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432432
@ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433433
@ </p>
434434
login_insert_csrf_secret();
435
- if( g.okAdmin ){
435
+ if( g.perm.Admin ){
436436
@ <p>Report owner:
437437
@ <input type="text" name="w" size="20" value="%h(zOwner)" />
438438
@ </p>
439439
} else {
440440
@ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443443
@ color key is displayed.) Each line contains the text for a single
444444
@ entry in the key. The first token of each line is the background
445445
@ color for that line.<br />
446446
@ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447447
@ </p>
448
- if( !g.okAdmin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
448
+ if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449449
@ <p>This report format is owned by %h(zOwner). You are not allowed
450450
@ to change it.</p>
451451
@ </form>
452452
report_format_hints();
453453
style_footer();
@@ -659,11 +659,11 @@
659659
for(i=0; i<nArg; i++){
660660
if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661661
pState->iBg = i;
662662
continue;
663663
}
664
- if( g.okWrite && azName[i][0]=='#' ){
664
+ if( g.perm.Write && azName[i][0]=='#' ){
665665
pState->nCol++;
666666
}
667667
if( !pState->isMultirow ){
668668
if( azName[i][0]=='_' ){
669669
pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680680
zTid = 0;
681681
for(i=0; i<nArg; i++){
682682
char *zName = azName[i];
683683
if( i==pState->iBg ) continue;
684684
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685
- if( g.okWrite && zTid ){
685
+ if( g.perm.Write && zTid ){
686686
@ <th>&nbsp;</th>
687687
zTid = 0;
688688
}
689689
if( zName[0]=='_' ) zName++;
690690
@ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693693
zTid = zName;
694694
}
695695
@ <th>%h(zName)</th>
696696
}
697697
}
698
- if( g.okWrite && zTid ){
698
+ if( g.perm.Write && zTid ){
699699
@ <th>&nbsp;</th>
700700
}
701701
@ </tr>
702702
}
703703
if( azArg==0 ){
@@ -726,11 +726,11 @@
726726
char *zData;
727727
if( i==pState->iBg ) continue;
728728
zData = azArg[i];
729729
if( zData==0 ) zData = "";
730730
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731
- if( zTid && g.okWrite ){
731
+ if( zTid && g.perm.Write ){
732732
@ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733733
zTid = 0;
734734
}
735735
if( zData[0] ){
736736
Blob content;
@@ -739,11 +739,11 @@
739739
wiki_convert(&content, 0, 0);
740740
blob_reset(&content);
741741
}
742742
}else if( azName[i][0]=='#' ){
743743
zTid = zData;
744
- if( g.okHistory ){
744
+ if( g.perm.History ){
745745
@ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746746
}else{
747747
@ <td valign="top">%h(zData)</td>
748748
}
749749
}else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752752
@ <td valign="top">
753753
@ %h(zData)
754754
@ </td>
755755
}
756756
}
757
- if( zTid && g.okWrite ){
757
+ if( zTid && g.perm.Write ){
758758
@ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759759
}
760760
@ </tr>
761761
return 0;
762762
}
@@ -915,11 +915,11 @@
915915
Stmt q;
916916
char *zErr1 = 0;
917917
char *zErr2 = 0;
918918
919919
login_check_credentials();
920
- if( !g.okRdTkt ){ login_needed(); return; }
920
+ if( !g.perm.RdTkt ){ login_needed(); return; }
921921
rn = atoi(PD("rn","0"));
922922
if( rn==0 ){
923923
cgi_redirect("reportlist");
924924
return;
925925
}
@@ -957,18 +957,18 @@
957957
struct GenerateHTML sState;
958958
959959
db_multi_exec("PRAGMA empty_result_callbacks=ON");
960960
style_submenu_element("Raw", "Raw",
961961
"rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962
- if( g.okAdmin
963
- || (g.okTktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
962
+ if( g.perm.Admin
963
+ || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964964
style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965965
}
966
- if( g.okTktFmt ){
966
+ if( g.perm.TktFmt ){
967967
style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968968
}
969
- if( g.okNewTkt ){
969
+ if( g.perm.NewTkt ){
970970
style_submenu_element("New Ticket", "Create a new ticket",
971971
"%s/tktnew", g.zTop);
972972
}
973973
style_header(zTitle);
974974
output_color_key(zClrKey, 1,
975975
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
34 Stmt q;
35 int rn = 0;
36 int cnt = 0;
37
38 login_check_credentials();
39 if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
40 style_header("Ticket Main Menu");
41 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
42 zScript = ticket_reportlist_code();
43 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
44
@@ -47,11 +47,11 @@
47
48 db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
49 while( db_step(&q)==SQLITE_ROW ){
50 const char *zTitle = db_column_text(&q, 1);
51 const char *zOwner = db_column_text(&q, 2);
52 if( zTitle[0] =='_' && !g.okTktFmt ){
53 continue;
54 }
55 rn = db_column_int(&q, 0);
56 cnt++;
57 blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
59 blob_appendf(&ril, "%s", zTitle);
60 } else {
61 blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
62 }
63 blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64 if( g.okWrite && zOwner && zOwner[0] ){
65 blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
66 }
67 if( g.okTktFmt ){
68 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
69 }
70 if( g.okAdmin
71 || (g.okWrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
72 ){
73 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
74 }
75 if( g.okTktFmt ){
76 blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
77 }
78 blob_appendf(&ril, "</li>\n");
79 }
80
@@ -184,11 +184,11 @@
184 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185 }
186 if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188 rc = SQLITE_DENY;
189 }else if( !g.okRdAddr && strncmp(zArg2, "private_", 8)==0 ){
190 rc = SQLITE_IGNORE;
191 }
192 break;
193 }
194 default: {
@@ -275,11 +275,11 @@
275 const char *zOwner;
276 const char *zClrKey;
277 Stmt q;
278
279 login_check_credentials();
280 if( !g.okTktFmt ){
281 login_needed();
282 return;
283 }
284 rn = atoi(PD("rn","0"));
285 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323 const char *zClrKey;
324 char *zSQL;
325 char *zErr = 0;
326
327 login_check_credentials();
328 if( !g.okTktFmt ){
329 login_needed();
330 return;
331 }
332 /*view_add_functions(0);*/
333 rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430 @ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431 @ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432 @ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433 @ </p>
434 login_insert_csrf_secret();
435 if( g.okAdmin ){
436 @ <p>Report owner:
437 @ <input type="text" name="w" size="20" value="%h(zOwner)" />
438 @ </p>
439 } else {
440 @ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443 @ color key is displayed.) Each line contains the text for a single
444 @ entry in the key. The first token of each line is the background
445 @ color for that line.<br />
446 @ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447 @ </p>
448 if( !g.okAdmin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449 @ <p>This report format is owned by %h(zOwner). You are not allowed
450 @ to change it.</p>
451 @ </form>
452 report_format_hints();
453 style_footer();
@@ -659,11 +659,11 @@
659 for(i=0; i<nArg; i++){
660 if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661 pState->iBg = i;
662 continue;
663 }
664 if( g.okWrite && azName[i][0]=='#' ){
665 pState->nCol++;
666 }
667 if( !pState->isMultirow ){
668 if( azName[i][0]=='_' ){
669 pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680 zTid = 0;
681 for(i=0; i<nArg; i++){
682 char *zName = azName[i];
683 if( i==pState->iBg ) continue;
684 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685 if( g.okWrite && zTid ){
686 @ <th>&nbsp;</th>
687 zTid = 0;
688 }
689 if( zName[0]=='_' ) zName++;
690 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693 zTid = zName;
694 }
695 @ <th>%h(zName)</th>
696 }
697 }
698 if( g.okWrite && zTid ){
699 @ <th>&nbsp;</th>
700 }
701 @ </tr>
702 }
703 if( azArg==0 ){
@@ -726,11 +726,11 @@
726 char *zData;
727 if( i==pState->iBg ) continue;
728 zData = azArg[i];
729 if( zData==0 ) zData = "";
730 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731 if( zTid && g.okWrite ){
732 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733 zTid = 0;
734 }
735 if( zData[0] ){
736 Blob content;
@@ -739,11 +739,11 @@
739 wiki_convert(&content, 0, 0);
740 blob_reset(&content);
741 }
742 }else if( azName[i][0]=='#' ){
743 zTid = zData;
744 if( g.okHistory ){
745 @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746 }else{
747 @ <td valign="top">%h(zData)</td>
748 }
749 }else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752 @ <td valign="top">
753 @ %h(zData)
754 @ </td>
755 }
756 }
757 if( zTid && g.okWrite ){
758 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759 }
760 @ </tr>
761 return 0;
762 }
@@ -915,11 +915,11 @@
915 Stmt q;
916 char *zErr1 = 0;
917 char *zErr2 = 0;
918
919 login_check_credentials();
920 if( !g.okRdTkt ){ login_needed(); return; }
921 rn = atoi(PD("rn","0"));
922 if( rn==0 ){
923 cgi_redirect("reportlist");
924 return;
925 }
@@ -957,18 +957,18 @@
957 struct GenerateHTML sState;
958
959 db_multi_exec("PRAGMA empty_result_callbacks=ON");
960 style_submenu_element("Raw", "Raw",
961 "rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962 if( g.okAdmin
963 || (g.okTktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964 style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965 }
966 if( g.okTktFmt ){
967 style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968 }
969 if( g.okNewTkt ){
970 style_submenu_element("New Ticket", "Create a new ticket",
971 "%s/tktnew", g.zTop);
972 }
973 style_header(zTitle);
974 output_color_key(zClrKey, 1,
975
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
34 Stmt q;
35 int rn = 0;
36 int cnt = 0;
37
38 login_check_credentials();
39 if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; }
40 style_header("Ticket Main Menu");
41 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
42 zScript = ticket_reportlist_code();
43 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
44
@@ -47,11 +47,11 @@
47
48 db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
49 while( db_step(&q)==SQLITE_ROW ){
50 const char *zTitle = db_column_text(&q, 1);
51 const char *zOwner = db_column_text(&q, 2);
52 if( zTitle[0] =='_' && !g.perm.TktFmt ){
53 continue;
54 }
55 rn = db_column_int(&q, 0);
56 cnt++;
57 blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
59 blob_appendf(&ril, "%s", zTitle);
60 } else {
61 blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
62 }
63 blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64 if( g.perm.Write && zOwner && zOwner[0] ){
65 blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
66 }
67 if( g.perm.TktFmt ){
68 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
69 }
70 if( g.perm.Admin
71 || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
72 ){
73 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
74 }
75 if( g.perm.TktFmt ){
76 blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
77 }
78 blob_appendf(&ril, "</li>\n");
79 }
80
@@ -184,11 +184,11 @@
184 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185 }
186 if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188 rc = SQLITE_DENY;
189 }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
190 rc = SQLITE_IGNORE;
191 }
192 break;
193 }
194 default: {
@@ -275,11 +275,11 @@
275 const char *zOwner;
276 const char *zClrKey;
277 Stmt q;
278
279 login_check_credentials();
280 if( !g.perm.TktFmt ){
281 login_needed();
282 return;
283 }
284 rn = atoi(PD("rn","0"));
285 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323 const char *zClrKey;
324 char *zSQL;
325 char *zErr = 0;
326
327 login_check_credentials();
328 if( !g.perm.TktFmt ){
329 login_needed();
330 return;
331 }
332 /*view_add_functions(0);*/
333 rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430 @ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431 @ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432 @ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433 @ </p>
434 login_insert_csrf_secret();
435 if( g.perm.Admin ){
436 @ <p>Report owner:
437 @ <input type="text" name="w" size="20" value="%h(zOwner)" />
438 @ </p>
439 } else {
440 @ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443 @ color key is displayed.) Each line contains the text for a single
444 @ entry in the key. The first token of each line is the background
445 @ color for that line.<br />
446 @ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447 @ </p>
448 if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449 @ <p>This report format is owned by %h(zOwner). You are not allowed
450 @ to change it.</p>
451 @ </form>
452 report_format_hints();
453 style_footer();
@@ -659,11 +659,11 @@
659 for(i=0; i<nArg; i++){
660 if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661 pState->iBg = i;
662 continue;
663 }
664 if( g.perm.Write && azName[i][0]=='#' ){
665 pState->nCol++;
666 }
667 if( !pState->isMultirow ){
668 if( azName[i][0]=='_' ){
669 pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680 zTid = 0;
681 for(i=0; i<nArg; i++){
682 char *zName = azName[i];
683 if( i==pState->iBg ) continue;
684 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685 if( g.perm.Write && zTid ){
686 @ <th>&nbsp;</th>
687 zTid = 0;
688 }
689 if( zName[0]=='_' ) zName++;
690 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693 zTid = zName;
694 }
695 @ <th>%h(zName)</th>
696 }
697 }
698 if( g.perm.Write && zTid ){
699 @ <th>&nbsp;</th>
700 }
701 @ </tr>
702 }
703 if( azArg==0 ){
@@ -726,11 +726,11 @@
726 char *zData;
727 if( i==pState->iBg ) continue;
728 zData = azArg[i];
729 if( zData==0 ) zData = "";
730 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731 if( zTid && g.perm.Write ){
732 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733 zTid = 0;
734 }
735 if( zData[0] ){
736 Blob content;
@@ -739,11 +739,11 @@
739 wiki_convert(&content, 0, 0);
740 blob_reset(&content);
741 }
742 }else if( azName[i][0]=='#' ){
743 zTid = zData;
744 if( g.perm.History ){
745 @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746 }else{
747 @ <td valign="top">%h(zData)</td>
748 }
749 }else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752 @ <td valign="top">
753 @ %h(zData)
754 @ </td>
755 }
756 }
757 if( zTid && g.perm.Write ){
758 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759 }
760 @ </tr>
761 return 0;
762 }
@@ -915,11 +915,11 @@
915 Stmt q;
916 char *zErr1 = 0;
917 char *zErr2 = 0;
918
919 login_check_credentials();
920 if( !g.perm.RdTkt ){ login_needed(); return; }
921 rn = atoi(PD("rn","0"));
922 if( rn==0 ){
923 cgi_redirect("reportlist");
924 return;
925 }
@@ -957,18 +957,18 @@
957 struct GenerateHTML sState;
958
959 db_multi_exec("PRAGMA empty_result_callbacks=ON");
960 style_submenu_element("Raw", "Raw",
961 "rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962 if( g.perm.Admin
963 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964 style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965 }
966 if( g.perm.TktFmt ){
967 style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968 }
969 if( g.perm.NewTkt ){
970 style_submenu_element("New Ticket", "Create a new ticket",
971 "%s/tktnew", g.zTop);
972 }
973 style_header(zTitle);
974 output_color_key(zClrKey, 1,
975
+11 -11
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
4444
@ FROM event, blob
4545
@ WHERE blob.rid=event.objid
4646
;
4747
4848
login_check_credentials();
49
- if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){
49
+ if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
5050
return;
5151
}
5252
5353
blob_zero(&bSQL);
5454
blob_append( &bSQL, zSQL1, -1 );
5555
5656
if( zType[0]!='a' ){
57
- if( zType[0]=='c' && !g.okRead ) zType = "x";
58
- if( zType[0]=='w' && !g.okRdWiki ) zType = "x";
59
- if( zType[0]=='t' && !g.okRdTkt ) zType = "x";
57
+ if( zType[0]=='c' && !g.perm.Read ) zType = "x";
58
+ if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
59
+ if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
6060
blob_appendf(&bSQL, " AND event.type=%Q", zType);
6161
}else{
62
- if( !g.okRead ){
63
- if( g.okRdTkt && g.okRdWiki ){
62
+ if( !g.perm.Read ){
63
+ if( g.perm.RdTkt && g.perm.RdWiki ){
6464
blob_append(&bSQL, " AND event.type!='ci'", -1);
65
- }else if( g.okRdTkt ){
65
+ }else if( g.perm.RdTkt ){
6666
blob_append(&bSQL, " AND event.type=='t'", -1);
6767
}else{
6868
blob_append(&bSQL, " AND event.type=='w'", -1);
6969
}
70
- }else if( !g.okRdWiki ){
71
- if( g.okRdTkt ){
70
+ }else if( !g.perm.RdWiki ){
71
+ if( g.perm.RdTkt ){
7272
blob_append(&bSQL, " AND event.type!='w'", -1);
7373
}else{
7474
blob_append(&bSQL, " AND event.type=='ci'", -1);
7575
}
76
- }else if( !g.okRdTkt ){
77
- assert( !g.okRdTkt &&& g.okRead && g.okRdWiki );
76
+ }else if( !g.perm.RdTkt ){
77
+ assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
7878
blob_append(&bSQL, " AND event.type!='t'", -1);
7979
}
8080
}
8181
8282
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
8383
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
44 @ FROM event, blob
45 @ WHERE blob.rid=event.objid
46 ;
47
48 login_check_credentials();
49 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){
50 return;
51 }
52
53 blob_zero(&bSQL);
54 blob_append( &bSQL, zSQL1, -1 );
55
56 if( zType[0]!='a' ){
57 if( zType[0]=='c' && !g.okRead ) zType = "x";
58 if( zType[0]=='w' && !g.okRdWiki ) zType = "x";
59 if( zType[0]=='t' && !g.okRdTkt ) zType = "x";
60 blob_appendf(&bSQL, " AND event.type=%Q", zType);
61 }else{
62 if( !g.okRead ){
63 if( g.okRdTkt && g.okRdWiki ){
64 blob_append(&bSQL, " AND event.type!='ci'", -1);
65 }else if( g.okRdTkt ){
66 blob_append(&bSQL, " AND event.type=='t'", -1);
67 }else{
68 blob_append(&bSQL, " AND event.type=='w'", -1);
69 }
70 }else if( !g.okRdWiki ){
71 if( g.okRdTkt ){
72 blob_append(&bSQL, " AND event.type!='w'", -1);
73 }else{
74 blob_append(&bSQL, " AND event.type=='ci'", -1);
75 }
76 }else if( !g.okRdTkt ){
77 assert( !g.okRdTkt &&& g.okRead && g.okRdWiki );
78 blob_append(&bSQL, " AND event.type!='t'", -1);
79 }
80 }
81
82 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
83
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
44 @ FROM event, blob
45 @ WHERE blob.rid=event.objid
46 ;
47
48 login_check_credentials();
49 if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
50 return;
51 }
52
53 blob_zero(&bSQL);
54 blob_append( &bSQL, zSQL1, -1 );
55
56 if( zType[0]!='a' ){
57 if( zType[0]=='c' && !g.perm.Read ) zType = "x";
58 if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
59 if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
60 blob_appendf(&bSQL, " AND event.type=%Q", zType);
61 }else{
62 if( !g.perm.Read ){
63 if( g.perm.RdTkt && g.perm.RdWiki ){
64 blob_append(&bSQL, " AND event.type!='ci'", -1);
65 }else if( g.perm.RdTkt ){
66 blob_append(&bSQL, " AND event.type=='t'", -1);
67 }else{
68 blob_append(&bSQL, " AND event.type=='w'", -1);
69 }
70 }else if( !g.perm.RdWiki ){
71 if( g.perm.RdTkt ){
72 blob_append(&bSQL, " AND event.type!='w'", -1);
73 }else{
74 blob_append(&bSQL, " AND event.type=='ci'", -1);
75 }
76 }else if( !g.perm.RdTkt ){
77 assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
78 blob_append(&bSQL, " AND event.type!='t'", -1);
79 }
80 }
81
82 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
83
+17 -17
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
5252
/*
5353
** WEBPAGE: /setup
5454
*/
5555
void setup_page(void){
5656
login_check_credentials();
57
- if( !g.okSetup ){
57
+ if( !g.perm.Setup ){
5858
login_needed();
5959
}
6060
6161
style_header("Server Administration");
6262
@ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106106
*/
107107
void setup_ulist(void){
108108
Stmt s;
109109
110110
login_check_credentials();
111
- if( !g.okAdmin ){
111
+ if( !g.perm.Admin ){
112112
login_needed();
113113
return;
114114
}
115115
116116
style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127127
db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128128
while( db_step(&s)==SQLITE_ROW ){
129129
const char *zCap = db_column_text(&s, 2);
130130
@ <tr>
131131
@ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132
- if( g.okAdmin && (zCap[0]!='s' || g.okSetup) ){
132
+ if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
133133
@ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134134
}
135135
@ %h(db_column_text(&s,1))
136
- if( g.okAdmin ){
136
+ if( g.perm.Admin ){
137137
@ </a>
138138
}
139139
@ </td>
140140
@ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141141
@ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259259
/* user doing the editing is ADMIN. Disallow editing */
260260
261261
/* Must have ADMIN privleges to access this page
262262
*/
263263
login_check_credentials();
264
- if( !g.okAdmin ){ login_needed(); return; }
264
+ if( !g.perm.Admin ){ login_needed(); return; }
265265
266266
/* Check to see if an ADMIN user is trying to edit a SETUP account.
267267
** Don't allow that.
268268
*/
269269
zId = PD("id", "0");
270270
uid = atoi(zId);
271
- if( zId && !g.okSetup && uid>0 ){
271
+ if( zId && !g.perm.Setup && uid>0 ){
272272
char *zOldCaps;
273273
zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274274
higherUser = zOldCaps && strchr(zOldCaps,'s');
275275
}
276276
@@ -296,11 +296,11 @@
296296
int ak = P("ak")!=0;
297297
int an = P("an")!=0;
298298
int ao = P("ao")!=0;
299299
int ap = P("ap")!=0;
300300
int ar = P("ar")!=0;
301
- int as = g.okSetup && P("as")!=0;
301
+ int as = g.perm.Setup && P("as")!=0;
302302
int aw = P("aw")!=0;
303303
int ac = P("ac")!=0;
304304
int af = P("af")!=0;
305305
int am = P("am")!=0;
306306
int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513513
@ </tr>
514514
@ <tr>
515515
@ <td class="usetupEditLabel">Capabilities:</td>
516516
@ <td>
517517
#define B(x) inherit[x]
518
- if( g.okSetup ){
518
+ if( g.perm.Setup ){
519519
@ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520520
}
521521
@ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522522
@ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523523
@ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816816
/*
817817
** WEBPAGE: setup_access
818818
*/
819819
void setup_access(void){
820820
login_check_credentials();
821
- if( !g.okSetup ){
821
+ if( !g.perm.Setup ){
822822
login_needed();
823823
}
824824
825825
style_header("Access Control Settings");
826826
db_begin_transaction();
@@ -918,11 +918,11 @@
918918
const char *zLogin = PD("login", "");
919919
const char *zPw = PD("pw", "");
920920
const char *zNewName = PD("newname", "New Login Group");
921921
922922
login_check_credentials();
923
- if( !g.okSetup ){
923
+ if( !g.perm.Setup ){
924924
login_needed();
925925
}
926926
file_canonical_name(g.zRepositoryName, &fullName);
927927
zSelfRepo = mprintf(blob_str(&fullName));
928928
blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
10041004
/*
10051005
** WEBPAGE: setup_timeline
10061006
*/
10071007
void setup_timeline(void){
10081008
login_check_credentials();
1009
- if( !g.okSetup ){
1009
+ if( !g.perm.Setup ){
10101010
login_needed();
10111011
}
10121012
10131013
style_header("Timeline Display Preferences");
10141014
db_begin_transaction();
@@ -1053,11 +1053,11 @@
10531053
*/
10541054
void setup_settings(void){
10551055
struct stControlSettings const *pSet;
10561056
10571057
login_check_credentials();
1058
- if( !g.okSetup ){
1058
+ if( !g.perm.Setup ){
10591059
login_needed();
10601060
}
10611061
10621062
style_header("Settings");
10631063
db_open_local();
@@ -1107,11 +1107,11 @@
11071107
/*
11081108
** WEBPAGE: setup_config
11091109
*/
11101110
void setup_config(void){
11111111
login_check_credentials();
1112
- if( !g.okSetup ){
1112
+ if( !g.perm.Setup ){
11131113
login_needed();
11141114
}
11151115
11161116
style_header("WWW Configuration");
11171117
db_begin_transaction();
@@ -1171,11 +1171,11 @@
11711171
/*
11721172
** WEBPAGE: setup_editcss
11731173
*/
11741174
void setup_editcss(void){
11751175
login_check_credentials();
1176
- if( !g.okSetup ){
1176
+ if( !g.perm.Setup ){
11771177
login_needed();
11781178
}
11791179
db_begin_transaction();
11801180
if( P("clear")!=0 ){
11811181
db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
12151215
/*
12161216
** WEBPAGE: setup_header
12171217
*/
12181218
void setup_header(void){
12191219
login_check_credentials();
1220
- if( !g.okSetup ){
1220
+ if( !g.perm.Setup ){
12211221
login_needed();
12221222
}
12231223
db_begin_transaction();
12241224
if( P("clear")!=0 ){
12251225
db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
12531253
/*
12541254
** WEBPAGE: setup_footer
12551255
*/
12561256
void setup_footer(void){
12571257
login_check_credentials();
1258
- if( !g.okSetup ){
1258
+ if( !g.perm.Setup ){
12591259
login_needed();
12601260
}
12611261
db_begin_transaction();
12621262
if( P("clear")!=0 ){
12631263
db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
12961296
int szImg = atoi(PD("im:bytes","0"));
12971297
if( szImg>0 ){
12981298
zMime = PD("im:mimetype","image/gif");
12991299
}
13001300
login_check_credentials();
1301
- if( !g.okSetup ){
1301
+ if( !g.perm.Setup ){
13021302
login_needed();
13031303
}
13041304
db_begin_transaction();
13051305
if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
13061306
Blob img;
13071307
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
52 /*
53 ** WEBPAGE: /setup
54 */
55 void setup_page(void){
56 login_check_credentials();
57 if( !g.okSetup ){
58 login_needed();
59 }
60
61 style_header("Server Administration");
62 @ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106 */
107 void setup_ulist(void){
108 Stmt s;
109
110 login_check_credentials();
111 if( !g.okAdmin ){
112 login_needed();
113 return;
114 }
115
116 style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127 db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128 while( db_step(&s)==SQLITE_ROW ){
129 const char *zCap = db_column_text(&s, 2);
130 @ <tr>
131 @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132 if( g.okAdmin && (zCap[0]!='s' || g.okSetup) ){
133 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134 }
135 @ %h(db_column_text(&s,1))
136 if( g.okAdmin ){
137 @ </a>
138 }
139 @ </td>
140 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141 @ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259 /* user doing the editing is ADMIN. Disallow editing */
260
261 /* Must have ADMIN privleges to access this page
262 */
263 login_check_credentials();
264 if( !g.okAdmin ){ login_needed(); return; }
265
266 /* Check to see if an ADMIN user is trying to edit a SETUP account.
267 ** Don't allow that.
268 */
269 zId = PD("id", "0");
270 uid = atoi(zId);
271 if( zId && !g.okSetup && uid>0 ){
272 char *zOldCaps;
273 zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274 higherUser = zOldCaps && strchr(zOldCaps,'s');
275 }
276
@@ -296,11 +296,11 @@
296 int ak = P("ak")!=0;
297 int an = P("an")!=0;
298 int ao = P("ao")!=0;
299 int ap = P("ap")!=0;
300 int ar = P("ar")!=0;
301 int as = g.okSetup && P("as")!=0;
302 int aw = P("aw")!=0;
303 int ac = P("ac")!=0;
304 int af = P("af")!=0;
305 int am = P("am")!=0;
306 int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513 @ </tr>
514 @ <tr>
515 @ <td class="usetupEditLabel">Capabilities:</td>
516 @ <td>
517 #define B(x) inherit[x]
518 if( g.okSetup ){
519 @ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520 }
521 @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522 @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523 @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816 /*
817 ** WEBPAGE: setup_access
818 */
819 void setup_access(void){
820 login_check_credentials();
821 if( !g.okSetup ){
822 login_needed();
823 }
824
825 style_header("Access Control Settings");
826 db_begin_transaction();
@@ -918,11 +918,11 @@
918 const char *zLogin = PD("login", "");
919 const char *zPw = PD("pw", "");
920 const char *zNewName = PD("newname", "New Login Group");
921
922 login_check_credentials();
923 if( !g.okSetup ){
924 login_needed();
925 }
926 file_canonical_name(g.zRepositoryName, &fullName);
927 zSelfRepo = mprintf(blob_str(&fullName));
928 blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
1004 /*
1005 ** WEBPAGE: setup_timeline
1006 */
1007 void setup_timeline(void){
1008 login_check_credentials();
1009 if( !g.okSetup ){
1010 login_needed();
1011 }
1012
1013 style_header("Timeline Display Preferences");
1014 db_begin_transaction();
@@ -1053,11 +1053,11 @@
1053 */
1054 void setup_settings(void){
1055 struct stControlSettings const *pSet;
1056
1057 login_check_credentials();
1058 if( !g.okSetup ){
1059 login_needed();
1060 }
1061
1062 style_header("Settings");
1063 db_open_local();
@@ -1107,11 +1107,11 @@
1107 /*
1108 ** WEBPAGE: setup_config
1109 */
1110 void setup_config(void){
1111 login_check_credentials();
1112 if( !g.okSetup ){
1113 login_needed();
1114 }
1115
1116 style_header("WWW Configuration");
1117 db_begin_transaction();
@@ -1171,11 +1171,11 @@
1171 /*
1172 ** WEBPAGE: setup_editcss
1173 */
1174 void setup_editcss(void){
1175 login_check_credentials();
1176 if( !g.okSetup ){
1177 login_needed();
1178 }
1179 db_begin_transaction();
1180 if( P("clear")!=0 ){
1181 db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
1215 /*
1216 ** WEBPAGE: setup_header
1217 */
1218 void setup_header(void){
1219 login_check_credentials();
1220 if( !g.okSetup ){
1221 login_needed();
1222 }
1223 db_begin_transaction();
1224 if( P("clear")!=0 ){
1225 db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
1253 /*
1254 ** WEBPAGE: setup_footer
1255 */
1256 void setup_footer(void){
1257 login_check_credentials();
1258 if( !g.okSetup ){
1259 login_needed();
1260 }
1261 db_begin_transaction();
1262 if( P("clear")!=0 ){
1263 db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
1296 int szImg = atoi(PD("im:bytes","0"));
1297 if( szImg>0 ){
1298 zMime = PD("im:mimetype","image/gif");
1299 }
1300 login_check_credentials();
1301 if( !g.okSetup ){
1302 login_needed();
1303 }
1304 db_begin_transaction();
1305 if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
1306 Blob img;
1307
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
52 /*
53 ** WEBPAGE: /setup
54 */
55 void setup_page(void){
56 login_check_credentials();
57 if( !g.perm.Setup ){
58 login_needed();
59 }
60
61 style_header("Server Administration");
62 @ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106 */
107 void setup_ulist(void){
108 Stmt s;
109
110 login_check_credentials();
111 if( !g.perm.Admin ){
112 login_needed();
113 return;
114 }
115
116 style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127 db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128 while( db_step(&s)==SQLITE_ROW ){
129 const char *zCap = db_column_text(&s, 2);
130 @ <tr>
131 @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132 if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
133 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134 }
135 @ %h(db_column_text(&s,1))
136 if( g.perm.Admin ){
137 @ </a>
138 }
139 @ </td>
140 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141 @ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259 /* user doing the editing is ADMIN. Disallow editing */
260
261 /* Must have ADMIN privleges to access this page
262 */
263 login_check_credentials();
264 if( !g.perm.Admin ){ login_needed(); return; }
265
266 /* Check to see if an ADMIN user is trying to edit a SETUP account.
267 ** Don't allow that.
268 */
269 zId = PD("id", "0");
270 uid = atoi(zId);
271 if( zId && !g.perm.Setup && uid>0 ){
272 char *zOldCaps;
273 zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274 higherUser = zOldCaps && strchr(zOldCaps,'s');
275 }
276
@@ -296,11 +296,11 @@
296 int ak = P("ak")!=0;
297 int an = P("an")!=0;
298 int ao = P("ao")!=0;
299 int ap = P("ap")!=0;
300 int ar = P("ar")!=0;
301 int as = g.perm.Setup && P("as")!=0;
302 int aw = P("aw")!=0;
303 int ac = P("ac")!=0;
304 int af = P("af")!=0;
305 int am = P("am")!=0;
306 int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513 @ </tr>
514 @ <tr>
515 @ <td class="usetupEditLabel">Capabilities:</td>
516 @ <td>
517 #define B(x) inherit[x]
518 if( g.perm.Setup ){
519 @ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520 }
521 @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522 @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523 @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816 /*
817 ** WEBPAGE: setup_access
818 */
819 void setup_access(void){
820 login_check_credentials();
821 if( !g.perm.Setup ){
822 login_needed();
823 }
824
825 style_header("Access Control Settings");
826 db_begin_transaction();
@@ -918,11 +918,11 @@
918 const char *zLogin = PD("login", "");
919 const char *zPw = PD("pw", "");
920 const char *zNewName = PD("newname", "New Login Group");
921
922 login_check_credentials();
923 if( !g.perm.Setup ){
924 login_needed();
925 }
926 file_canonical_name(g.zRepositoryName, &fullName);
927 zSelfRepo = mprintf(blob_str(&fullName));
928 blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
1004 /*
1005 ** WEBPAGE: setup_timeline
1006 */
1007 void setup_timeline(void){
1008 login_check_credentials();
1009 if( !g.perm.Setup ){
1010 login_needed();
1011 }
1012
1013 style_header("Timeline Display Preferences");
1014 db_begin_transaction();
@@ -1053,11 +1053,11 @@
1053 */
1054 void setup_settings(void){
1055 struct stControlSettings const *pSet;
1056
1057 login_check_credentials();
1058 if( !g.perm.Setup ){
1059 login_needed();
1060 }
1061
1062 style_header("Settings");
1063 db_open_local();
@@ -1107,11 +1107,11 @@
1107 /*
1108 ** WEBPAGE: setup_config
1109 */
1110 void setup_config(void){
1111 login_check_credentials();
1112 if( !g.perm.Setup ){
1113 login_needed();
1114 }
1115
1116 style_header("WWW Configuration");
1117 db_begin_transaction();
@@ -1171,11 +1171,11 @@
1171 /*
1172 ** WEBPAGE: setup_editcss
1173 */
1174 void setup_editcss(void){
1175 login_check_credentials();
1176 if( !g.perm.Setup ){
1177 login_needed();
1178 }
1179 db_begin_transaction();
1180 if( P("clear")!=0 ){
1181 db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
1215 /*
1216 ** WEBPAGE: setup_header
1217 */
1218 void setup_header(void){
1219 login_check_credentials();
1220 if( !g.perm.Setup ){
1221 login_needed();
1222 }
1223 db_begin_transaction();
1224 if( P("clear")!=0 ){
1225 db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
1253 /*
1254 ** WEBPAGE: setup_footer
1255 */
1256 void setup_footer(void){
1257 login_check_credentials();
1258 if( !g.perm.Setup ){
1259 login_needed();
1260 }
1261 db_begin_transaction();
1262 if( P("clear")!=0 ){
1263 db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
1296 int szImg = atoi(PD("im:bytes","0"));
1297 if( szImg>0 ){
1298 zMime = PD("im:mimetype","image/gif");
1299 }
1300 login_check_credentials();
1301 if( !g.perm.Setup ){
1302 login_needed();
1303 }
1304 db_begin_transaction();
1305 if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
1306 Blob img;
1307
+3 -3
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
4444
const char *zUuid = P("uuid");
4545
int nUuid;
4646
char zCanonical[UUID_SIZE+1];
4747
4848
login_check_credentials();
49
- if( !g.okAdmin ){
49
+ if( !g.perm.Admin ){
5050
login_needed();
5151
}
5252
if( P("rebuild") ){
5353
db_close(1);
5454
db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219219
int ofst = atoi(PD("ofst","0"));
220220
int cnt;
221221
Stmt q;
222222
223223
login_check_credentials();
224
- if( !g.okAdmin ){
224
+ if( !g.perm.Admin ){
225225
login_needed();
226226
}
227227
style_header("Content Sources");
228228
if( ofst>0 ){
229229
style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282282
void rcvfrom_page(void){
283283
int rcvid = atoi(PD("rcvid","0"));
284284
Stmt q;
285285
286286
login_check_credentials();
287
- if( !g.okAdmin ){
287
+ if( !g.perm.Admin ){
288288
login_needed();
289289
}
290290
style_header("Content Source %d", rcvid);
291291
db_prepare(&q,
292292
"SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293293
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
44 const char *zUuid = P("uuid");
45 int nUuid;
46 char zCanonical[UUID_SIZE+1];
47
48 login_check_credentials();
49 if( !g.okAdmin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219 int ofst = atoi(PD("ofst","0"));
220 int cnt;
221 Stmt q;
222
223 login_check_credentials();
224 if( !g.okAdmin ){
225 login_needed();
226 }
227 style_header("Content Sources");
228 if( ofst>0 ){
229 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282 void rcvfrom_page(void){
283 int rcvid = atoi(PD("rcvid","0"));
284 Stmt q;
285
286 login_check_credentials();
287 if( !g.okAdmin ){
288 login_needed();
289 }
290 style_header("Content Source %d", rcvid);
291 db_prepare(&q,
292 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
44 const char *zUuid = P("uuid");
45 int nUuid;
46 char zCanonical[UUID_SIZE+1];
47
48 login_check_credentials();
49 if( !g.perm.Admin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219 int ofst = atoi(PD("ofst","0"));
220 int cnt;
221 Stmt q;
222
223 login_check_credentials();
224 if( !g.perm.Admin ){
225 login_needed();
226 }
227 style_header("Content Sources");
228 if( ofst>0 ){
229 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282 void rcvfrom_page(void){
283 int rcvid = atoi(PD("rcvid","0"));
284 Stmt q;
285
286 login_check_credentials();
287 if( !g.perm.Admin ){
288 login_needed();
289 }
290 style_header("Content Source %d", rcvid);
291 db_prepare(&q,
292 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293
+1 -1
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
10251025
const char *zCurrent; /* Current skin */
10261026
int i; /* Loop counter */
10271027
Stmt q;
10281028
10291029
login_check_credentials();
1030
- if( !g.okSetup ){
1030
+ if( !g.perm.Setup ){
10311031
login_needed();
10321032
}
10331033
db_begin_transaction();
10341034
10351035
/* Process requests to delete a user-defined skin */
10361036
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
1025 const char *zCurrent; /* Current skin */
1026 int i; /* Loop counter */
1027 Stmt q;
1028
1029 login_check_credentials();
1030 if( !g.okSetup ){
1031 login_needed();
1032 }
1033 db_begin_transaction();
1034
1035 /* Process requests to delete a user-defined skin */
1036
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
1025 const char *zCurrent; /* Current skin */
1026 int i; /* Loop counter */
1027 Stmt q;
1028
1029 login_check_credentials();
1030 if( !g.perm.Setup ){
1031 login_needed();
1032 }
1033 db_begin_transaction();
1034
1035 /* Process requests to delete a user-defined skin */
1036
+699 -151
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -24,10 +24,11 @@
2424
#endif
2525
#ifndef SQLITE_API
2626
# define SQLITE_API
2727
#endif
2828
/************** Begin file sqliteInt.h ***************************************/
29
+#line 1 "tsrc/sqliteInt.h"
2930
/*
3031
** 2001 September 15
3132
**
3233
** The author disclaims copyright to this source code. In place of
3334
** a legal notice, here is a blessing:
@@ -78,10 +79,11 @@
7879
#include "config.h"
7980
#endif
8081
8182
/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
8283
/************** Begin file sqliteLimit.h *************************************/
84
+#line 1 "tsrc/sqliteLimit.h"
8385
/*
8486
** 2007 May 7
8587
**
8688
** The author disclaims copyright to this source code. In place of
8789
** a legal notice, here is a blessing:
@@ -289,10 +291,11 @@
289291
# define SQLITE_MAX_TRIGGER_DEPTH 1000
290292
#endif
291293
292294
/************** End of sqliteLimit.h *****************************************/
293295
/************** Continuing where we left off in sqliteInt.h ******************/
296
+#line 54 "tsrc/sqliteInt.h"
294297
295298
/* Disable nuisance warnings on Borland compilers */
296299
#if defined(__BORLANDC__)
297300
#pragma warn -rch /* unreachable code */
298301
#pragma warn -ccc /* Condition is always true or false */
@@ -545,10 +548,11 @@
545548
# define unlikely(X) !!(X)
546549
#endif
547550
548551
/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
549552
/************** Begin file sqlite3.h *****************************************/
553
+#line 1 "tsrc/sqlite3.h"
550554
/*
551555
** 2001 September 15
552556
**
553557
** The author disclaims copyright to this source code. In place of
554558
** a legal notice, here is a blessing:
@@ -656,11 +660,11 @@
656660
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657661
** [sqlite_version()] and [sqlite_source_id()].
658662
*/
659663
#define SQLITE_VERSION "3.7.8"
660664
#define SQLITE_VERSION_NUMBER 3007008
661
-#define SQLITE_SOURCE_ID "2011-09-04 01:27:00 6b657ae75035eb10b0ad640998d3c9eadfdffa6e"
665
+#define SQLITE_SOURCE_ID "2011-09-14 13:41:40 a1f3aeeb0988c848d40ce8f6da6e902935a997e2"
662666
663667
/*
664668
** CAPI3REF: Run-Time Library Version Numbers
665669
** KEYWORDS: sqlite3_version, sqlite3_sourceid
666670
**
@@ -7305,12 +7309,14 @@
73057309
#endif /* ifndef _SQLITE3RTREE_H_ */
73067310
73077311
73087312
/************** End of sqlite3.h *********************************************/
73097313
/************** Continuing where we left off in sqliteInt.h ******************/
7314
+#line 309 "tsrc/sqliteInt.h"
73107315
/************** Include hash.h in the middle of sqliteInt.h ******************/
73117316
/************** Begin file hash.h ********************************************/
7317
+#line 1 "tsrc/hash.h"
73127318
/*
73137319
** 2001 September 22
73147320
**
73157321
** The author disclaims copyright to this source code. In place of
73167322
** a legal notice, here is a blessing:
@@ -7406,12 +7412,14 @@
74067412
74077413
#endif /* _SQLITE_HASH_H_ */
74087414
74097415
/************** End of hash.h ************************************************/
74107416
/************** Continuing where we left off in sqliteInt.h ******************/
7417
+#line 310 "tsrc/sqliteInt.h"
74117418
/************** Include parse.h in the middle of sqliteInt.h *****************/
74127419
/************** Begin file parse.h *******************************************/
7420
+#line 1 "tsrc/parse.h"
74137421
#define TK_SEMI 1
74147422
#define TK_EXPLAIN 2
74157423
#define TK_QUERY 3
74167424
#define TK_PLAN 4
74177425
#define TK_BEGIN 5
@@ -7568,10 +7576,11 @@
75687576
#define TK_UMINUS 156
75697577
#define TK_UPLUS 157
75707578
75717579
/************** End of parse.h ***********************************************/
75727580
/************** Continuing where we left off in sqliteInt.h ******************/
7581
+#line 311 "tsrc/sqliteInt.h"
75737582
#include <stdio.h>
75747583
#include <stdlib.h>
75757584
#include <string.h>
75767585
#include <assert.h>
75777586
#include <stddef.h>
@@ -7911,10 +7920,11 @@
79117920
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
79127921
** pointer types (i.e. FuncDef) defined above.
79137922
*/
79147923
/************** Include btree.h in the middle of sqliteInt.h *****************/
79157924
/************** Begin file btree.h *******************************************/
7925
+#line 1 "tsrc/btree.h"
79167926
/*
79177927
** 2001 September 15
79187928
**
79197929
** The author disclaims copyright to this source code. In place of
79207930
** a legal notice, here is a blessing:
@@ -8155,12 +8165,14 @@
81558165
81568166
#endif /* _BTREE_H_ */
81578167
81588168
/************** End of btree.h ***********************************************/
81598169
/************** Continuing where we left off in sqliteInt.h ******************/
8170
+#line 653 "tsrc/sqliteInt.h"
81608171
/************** Include vdbe.h in the middle of sqliteInt.h ******************/
81618172
/************** Begin file vdbe.h ********************************************/
8173
+#line 1 "tsrc/vdbe.h"
81628174
/*
81638175
** 2001 September 15
81648176
**
81658177
** The author disclaims copyright to this source code. In place of
81668178
** a legal notice, here is a blessing:
@@ -8321,10 +8333,11 @@
83218333
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
83228334
** header file that defines a number for each opcode used by the VDBE.
83238335
*/
83248336
/************** Include opcodes.h in the middle of vdbe.h ********************/
83258337
/************** Begin file opcodes.h *****************************************/
8338
+#line 1 "tsrc/opcodes.h"
83268339
/* Automatically generated. Do not edit */
83278340
/* See the mkopcodeh.awk script for details */
83288341
#define OP_Goto 1
83298342
#define OP_Gosub 2
83308343
#define OP_Return 3
@@ -8508,10 +8521,11 @@
85088521
/* 136 */ 0x00, 0x01, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04,\
85098522
/* 144 */ 0x04, 0x04, 0x02, 0x00, 0x00, 0x00,}
85108523
85118524
/************** End of opcodes.h *********************************************/
85128525
/************** Continuing where we left off in vdbe.h ***********************/
8526
+#line 164 "tsrc/vdbe.h"
85138527
85148528
/*
85158529
** Prototypes for the VDBE interface. See comments on the implementation
85168530
** for a description of what each of these routines does.
85178531
*/
@@ -8559,13 +8573,13 @@
85598573
SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);
85608574
#ifndef SQLITE_OMIT_TRACE
85618575
SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
85628576
#endif
85638577
8564
-SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int);
8565
-SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
8578
+SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
85668579
SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
8580
+SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);
85678581
85688582
#ifndef SQLITE_OMIT_TRIGGER
85698583
SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
85708584
#endif
85718585
@@ -8582,12 +8596,14 @@
85828596
85838597
#endif
85848598
85858599
/************** End of vdbe.h ************************************************/
85868600
/************** Continuing where we left off in sqliteInt.h ******************/
8601
+#line 654 "tsrc/sqliteInt.h"
85878602
/************** Include pager.h in the middle of sqliteInt.h *****************/
85888603
/************** Begin file pager.h *******************************************/
8604
+#line 1 "tsrc/pager.h"
85898605
/*
85908606
** 2001 September 15
85918607
**
85928608
** The author disclaims copyright to this source code. In place of
85938609
** a legal notice, here is a blessing:
@@ -8769,12 +8785,14 @@
87698785
87708786
#endif /* _PAGER_H_ */
87718787
87728788
/************** End of pager.h ***********************************************/
87738789
/************** Continuing where we left off in sqliteInt.h ******************/
8790
+#line 655 "tsrc/sqliteInt.h"
87748791
/************** Include pcache.h in the middle of sqliteInt.h ****************/
87758792
/************** Begin file pcache.h ******************************************/
8793
+#line 1 "tsrc/pcache.h"
87768794
/*
87778795
** 2008 August 05
87788796
**
87798797
** The author disclaims copyright to this source code. In place of
87808798
** a legal notice, here is a blessing:
@@ -8929,13 +8947,15 @@
89298947
89308948
#endif /* _PCACHE_H_ */
89318949
89328950
/************** End of pcache.h **********************************************/
89338951
/************** Continuing where we left off in sqliteInt.h ******************/
8952
+#line 656 "tsrc/sqliteInt.h"
89348953
89358954
/************** Include os.h in the middle of sqliteInt.h ********************/
89368955
/************** Begin file os.h **********************************************/
8956
+#line 1 "tsrc/os.h"
89378957
/*
89388958
** 2001 September 16
89398959
**
89408960
** The author disclaims copyright to this source code. In place of
89418961
** a legal notice, here is a blessing:
@@ -9214,12 +9234,14 @@
92149234
92159235
#endif /* _SQLITE_OS_H_ */
92169236
92179237
/************** End of os.h **************************************************/
92189238
/************** Continuing where we left off in sqliteInt.h ******************/
9239
+#line 658 "tsrc/sqliteInt.h"
92199240
/************** Include mutex.h in the middle of sqliteInt.h *****************/
92209241
/************** Begin file mutex.h *******************************************/
9242
+#line 1 "tsrc/mutex.h"
92219243
/*
92229244
** 2007 August 28
92239245
**
92249246
** The author disclaims copyright to this source code. In place of
92259247
** a legal notice, here is a blessing:
@@ -9290,10 +9312,11 @@
92909312
#define sqlite3MutexEnd()
92919313
#endif /* defined(SQLITE_MUTEX_OMIT) */
92929314
92939315
/************** End of mutex.h ***********************************************/
92949316
/************** Continuing where we left off in sqliteInt.h ******************/
9317
+#line 659 "tsrc/sqliteInt.h"
92959318
92969319
92979320
/*
92989321
** Each database file to be accessed by the system is an instance
92999322
** of the following structure. There are normally two of these structures
@@ -11892,10 +11915,11 @@
1189211915
1189311916
#endif /* _SQLITEINT_H_ */
1189411917
1189511918
/************** End of sqliteInt.h *******************************************/
1189611919
/************** Begin file global.c ******************************************/
11920
+#line 1 "tsrc/global.c"
1189711921
/*
1189811922
** 2008 June 13
1189911923
**
1190011924
** The author disclaims copyright to this source code. In place of
1190111925
** a legal notice, here is a blessing:
@@ -12114,10 +12138,11 @@
1211412138
*/
1211512139
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
1211612140
1211712141
/************** End of global.c **********************************************/
1211812142
/************** Begin file ctime.c *******************************************/
12143
+#line 1 "tsrc/ctime.c"
1211912144
/*
1212012145
** 2010 February 23
1212112146
**
1212212147
** The author disclaims copyright to this source code. In place of
1212312148
** a legal notice, here is a blessing:
@@ -12518,10 +12543,11 @@
1251812543
1251912544
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
1252012545
1252112546
/************** End of ctime.c ***********************************************/
1252212547
/************** Begin file status.c ******************************************/
12548
+#line 1 "tsrc/status.c"
1252312549
/*
1252412550
** 2008 June 18
1252512551
**
1252612552
** The author disclaims copyright to this source code. In place of
1252712553
** a legal notice, here is a blessing:
@@ -12535,10 +12561,11 @@
1253512561
** This module implements the sqlite3_status() interface and related
1253612562
** functionality.
1253712563
*/
1253812564
/************** Include vdbeInt.h in the middle of status.c ******************/
1253912565
/************** Begin file vdbeInt.h *****************************************/
12566
+#line 1 "tsrc/vdbeInt.h"
1254012567
/*
1254112568
** 2003 September 6
1254212569
**
1254312570
** The author disclaims copyright to this source code. In place of
1254412571
** a legal notice, here is a blessing:
@@ -12986,10 +13013,11 @@
1298613013
1298713014
#endif /* !defined(_VDBEINT_H_) */
1298813015
1298913016
/************** End of vdbeInt.h *********************************************/
1299013017
/************** Continuing where we left off in status.c *********************/
13018
+#line 18 "tsrc/status.c"
1299113019
1299213020
/*
1299313021
** Variables in which to record status information.
1299413022
*/
1299513023
typedef struct sqlite3StatType sqlite3StatType;
@@ -13199,10 +13227,11 @@
1319913227
return rc;
1320013228
}
1320113229
1320213230
/************** End of status.c **********************************************/
1320313231
/************** Begin file date.c ********************************************/
13232
+#line 1 "tsrc/date.c"
1320413233
/*
1320513234
** 2003 October 31
1320613235
**
1320713236
** The author disclaims copyright to this source code. In place of
1320813237
** a legal notice, here is a blessing:
@@ -14326,10 +14355,11 @@
1432614355
}
1432714356
}
1432814357
1432914358
/************** End of date.c ************************************************/
1433014359
/************** Begin file os.c **********************************************/
14360
+#line 1 "tsrc/os.c"
1433114361
/*
1433214362
** 2005 November 29
1433314363
**
1433414364
** The author disclaims copyright to this source code. In place of
1433514365
** a legal notice, here is a blessing:
@@ -14659,10 +14689,11 @@
1465914689
return SQLITE_OK;
1466014690
}
1466114691
1466214692
/************** End of os.c **************************************************/
1466314693
/************** Begin file fault.c *******************************************/
14694
+#line 1 "tsrc/fault.c"
1466414695
/*
1466514696
** 2008 Jan 22
1466614697
**
1466714698
** The author disclaims copyright to this source code. In place of
1466814699
** a legal notice, here is a blessing:
@@ -14748,10 +14779,11 @@
1474814779
1474914780
#endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */
1475014781
1475114782
/************** End of fault.c ***********************************************/
1475214783
/************** Begin file mem0.c ********************************************/
14784
+#line 1 "tsrc/mem0.c"
1475314785
/*
1475414786
** 2008 October 28
1475514787
**
1475614788
** The author disclaims copyright to this source code. In place of
1475714789
** a legal notice, here is a blessing:
@@ -14809,10 +14841,11 @@
1480914841
1481014842
#endif /* SQLITE_ZERO_MALLOC */
1481114843
1481214844
/************** End of mem0.c ************************************************/
1481314845
/************** Begin file mem1.c ********************************************/
14846
+#line 1 "tsrc/mem1.c"
1481414847
/*
1481514848
** 2007 August 14
1481614849
**
1481714850
** The author disclaims copyright to this source code. In place of
1481814851
** a legal notice, here is a blessing:
@@ -14961,10 +14994,11 @@
1496114994
1496214995
#endif /* SQLITE_SYSTEM_MALLOC */
1496314996
1496414997
/************** End of mem1.c ************************************************/
1496514998
/************** Begin file mem2.c ********************************************/
14999
+#line 1 "tsrc/mem2.c"
1496615000
/*
1496715001
** 2007 August 15
1496815002
**
1496915003
** The author disclaims copyright to this source code. In place of
1497015004
** a legal notice, here is a blessing:
@@ -15491,10 +15525,11 @@
1549115525
1549215526
#endif /* SQLITE_MEMDEBUG */
1549315527
1549415528
/************** End of mem2.c ************************************************/
1549515529
/************** Begin file mem3.c ********************************************/
15530
+#line 1 "tsrc/mem3.c"
1549615531
/*
1549715532
** 2007 October 14
1549815533
**
1549915534
** The author disclaims copyright to this source code. In place of
1550015535
** a legal notice, here is a blessing:
@@ -16180,10 +16215,11 @@
1618016215
1618116216
#endif /* SQLITE_ENABLE_MEMSYS3 */
1618216217
1618316218
/************** End of mem3.c ************************************************/
1618416219
/************** Begin file mem5.c ********************************************/
16220
+#line 1 "tsrc/mem5.c"
1618516221
/*
1618616222
** 2007 October 14
1618716223
**
1618816224
** The author disclaims copyright to this source code. In place of
1618916225
** a legal notice, here is a blessing:
@@ -16763,10 +16799,11 @@
1676316799
1676416800
#endif /* SQLITE_ENABLE_MEMSYS5 */
1676516801
1676616802
/************** End of mem5.c ************************************************/
1676716803
/************** Begin file mutex.c *******************************************/
16804
+#line 1 "tsrc/mutex.c"
1676816805
/*
1676916806
** 2007 August 14
1677016807
**
1677116808
** The author disclaims copyright to this source code. In place of
1677216809
** a legal notice, here is a blessing:
@@ -16918,10 +16955,11 @@
1691816955
1691916956
#endif /* SQLITE_MUTEX_OMIT */
1692016957
1692116958
/************** End of mutex.c ***********************************************/
1692216959
/************** Begin file mutex_noop.c **************************************/
16960
+#line 1 "tsrc/mutex_noop.c"
1692316961
/*
1692416962
** 2008 October 07
1692516963
**
1692616964
** The author disclaims copyright to this source code. In place of
1692716965
** a legal notice, here is a blessing:
@@ -17126,10 +17164,11 @@
1712617164
#endif /* SQLITE_MUTEX_NOOP */
1712717165
#endif /* SQLITE_MUTEX_OMIT */
1712817166
1712917167
/************** End of mutex_noop.c ******************************************/
1713017168
/************** Begin file mutex_os2.c ***************************************/
17169
+#line 1 "tsrc/mutex_os2.c"
1713117170
/*
1713217171
** 2007 August 28
1713317172
**
1713417173
** The author disclaims copyright to this source code. In place of
1713517174
** a legal notice, here is a blessing:
@@ -17402,10 +17441,11 @@
1740217441
}
1740317442
#endif /* SQLITE_MUTEX_OS2 */
1740417443
1740517444
/************** End of mutex_os2.c *******************************************/
1740617445
/************** Begin file mutex_unix.c **************************************/
17446
+#line 1 "tsrc/mutex_unix.c"
1740717447
/*
1740817448
** 2007 August 28
1740917449
**
1741017450
** The author disclaims copyright to this source code. In place of
1741117451
** a legal notice, here is a blessing:
@@ -17755,10 +17795,11 @@
1775517795
1775617796
#endif /* SQLITE_MUTEX_PTHREAD */
1775717797
1775817798
/************** End of mutex_unix.c ******************************************/
1775917799
/************** Begin file mutex_w32.c ***************************************/
17800
+#line 1 "tsrc/mutex_w32.c"
1776017801
/*
1776117802
** 2007 August 14
1776217803
**
1776317804
** The author disclaims copyright to this source code. In place of
1776417805
** a legal notice, here is a blessing:
@@ -18089,10 +18130,11 @@
1808918130
}
1809018131
#endif /* SQLITE_MUTEX_W32 */
1809118132
1809218133
/************** End of mutex_w32.c *******************************************/
1809318134
/************** Begin file malloc.c ******************************************/
18135
+#line 1 "tsrc/malloc.c"
1809418136
/*
1809518137
** 2001 September 15
1809618138
**
1809718139
** The author disclaims copyright to this source code. In place of
1809818140
** a legal notice, here is a blessing:
@@ -18868,10 +18910,11 @@
1886818910
return rc & (db ? db->errMask : 0xff);
1886918911
}
1887018912
1887118913
/************** End of malloc.c **********************************************/
1887218914
/************** Begin file printf.c ******************************************/
18915
+#line 1 "tsrc/printf.c"
1887318916
/*
1887418917
** The "printf" code that follows dates from the 1980's. It is in
1887518918
** the public domain. The original comments are included here for
1887618919
** completeness. They are very out-of-date but might be useful as
1887718920
** an historical reference. Most of the "enhancements" have been backed
@@ -19899,10 +19942,11 @@
1989919942
}
1990019943
#endif
1990119944
1990219945
/************** End of printf.c **********************************************/
1990319946
/************** Begin file random.c ******************************************/
19947
+#line 1 "tsrc/random.c"
1990419948
/*
1990519949
** 2001 September 15
1990619950
**
1990719951
** The author disclaims copyright to this source code. In place of
1990819952
** a legal notice, here is a blessing:
@@ -20046,10 +20090,11 @@
2004620090
}
2004720091
#endif /* SQLITE_OMIT_BUILTIN_TEST */
2004820092
2004920093
/************** End of random.c **********************************************/
2005020094
/************** Begin file utf.c *********************************************/
20095
+#line 1 "tsrc/utf.c"
2005120096
/*
2005220097
** 2004 April 13
2005320098
**
2005420099
** The author disclaims copyright to this source code. In place of
2005520100
** a legal notice, here is a blessing:
@@ -20607,10 +20652,11 @@
2060720652
#endif /* SQLITE_TEST */
2060820653
#endif /* SQLITE_OMIT_UTF16 */
2060920654
2061020655
/************** End of utf.c *************************************************/
2061120656
/************** Begin file util.c ********************************************/
20657
+#line 1 "tsrc/util.c"
2061220658
/*
2061320659
** 2001 September 15
2061420660
**
2061520661
** The author disclaims copyright to this source code. In place of
2061620662
** a legal notice, here is a blessing:
@@ -21789,10 +21835,11 @@
2178921835
}
2179021836
#endif
2179121837
2179221838
/************** End of util.c ************************************************/
2179321839
/************** Begin file hash.c ********************************************/
21840
+#line 1 "tsrc/hash.c"
2179421841
/*
2179521842
** 2001 September 22
2179621843
**
2179721844
** The author disclaims copyright to this source code. In place of
2179821845
** a legal notice, here is a blessing:
@@ -22068,10 +22115,11 @@
2206822115
return 0;
2206922116
}
2207022117
2207122118
/************** End of hash.c ************************************************/
2207222119
/************** Begin file opcodes.c *****************************************/
22120
+#line 1 "tsrc/opcodes.c"
2207322121
/* Automatically generated. Do not edit */
2207422122
/* See the mkopcodec.awk script for details. */
2207522123
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
2207622124
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
2207722125
static const char *const azName[] = { "?",
@@ -22229,10 +22277,11 @@
2222922277
}
2223022278
#endif
2223122279
2223222280
/************** End of opcodes.c *********************************************/
2223322281
/************** Begin file os_os2.c ******************************************/
22282
+#line 1 "tsrc/os_os2.c"
2223422283
/*
2223522284
** 2006 Feb 14
2223622285
**
2223722286
** The author disclaims copyright to this source code. In place of
2223822287
** a legal notice, here is a blessing:
@@ -22285,10 +22334,11 @@
2228522334
/*
2228622335
** Include code that is common to all os_*.c files
2228722336
*/
2228822337
/************** Include os_common.h in the middle of os_os2.c ****************/
2228922338
/************** Begin file os_common.h ***************************************/
22339
+#line 1 "tsrc/os_common.h"
2229022340
/*
2229122341
** 2004 May 22
2229222342
**
2229322343
** The author disclaims copyright to this source code. In place of
2229422344
** a legal notice, here is a blessing:
@@ -22338,10 +22388,11 @@
2233822388
** hwtime.h contains inline assembler code for implementing
2233922389
** high-performance timing routines.
2234022390
*/
2234122391
/************** Include hwtime.h in the middle of os_common.h ****************/
2234222392
/************** Begin file hwtime.h ******************************************/
22393
+#line 1 "tsrc/hwtime.h"
2234322394
/*
2234422395
** 2008 May 27
2234522396
**
2234622397
** The author disclaims copyright to this source code. In place of
2234722398
** a legal notice, here is a blessing:
@@ -22426,10 +22477,11 @@
2242622477
2242722478
#endif /* !defined(_HWTIME_H_) */
2242822479
2242922480
/************** End of hwtime.h **********************************************/
2243022481
/************** Continuing where we left off in os_common.h ******************/
22482
+#line 53 "tsrc/os_common.h"
2243122483
2243222484
static sqlite_uint64 g_start;
2243322485
static sqlite_uint64 g_elapsed;
2243422486
#define TIMER_START g_start=sqlite3Hwtime()
2243522487
#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -22492,10 +22544,11 @@
2249222544
2249322545
#endif /* !defined(_OS_COMMON_H_) */
2249422546
2249522547
/************** End of os_common.h *******************************************/
2249622548
/************** Continuing where we left off in os_os2.c *********************/
22549
+#line 57 "tsrc/os_os2.c"
2249722550
2249822551
/* Forward references */
2249922552
typedef struct os2File os2File; /* The file structure */
2250022553
typedef struct os2ShmNode os2ShmNode; /* A shared descritive memory node */
2250122554
typedef struct os2ShmLink os2ShmLink; /* A connection to shared-memory */
@@ -24363,10 +24416,11 @@
2436324416
2436424417
#endif /* SQLITE_OS_OS2 */
2436524418
2436624419
/************** End of os_os2.c **********************************************/
2436724420
/************** Begin file os_unix.c *****************************************/
24421
+#line 1 "tsrc/os_unix.c"
2436824422
/*
2436924423
** 2004 May 22
2437024424
**
2437124425
** The author disclaims copyright to this source code. In place of
2437224426
** a legal notice, here is a blessing:
@@ -24627,10 +24681,11 @@
2462724681
/*
2462824682
** Include code that is common to all os_*.c files
2462924683
*/
2463024684
/************** Include os_common.h in the middle of os_unix.c ***************/
2463124685
/************** Begin file os_common.h ***************************************/
24686
+#line 1 "tsrc/os_common.h"
2463224687
/*
2463324688
** 2004 May 22
2463424689
**
2463524690
** The author disclaims copyright to this source code. In place of
2463624691
** a legal notice, here is a blessing:
@@ -24680,10 +24735,11 @@
2468024735
** hwtime.h contains inline assembler code for implementing
2468124736
** high-performance timing routines.
2468224737
*/
2468324738
/************** Include hwtime.h in the middle of os_common.h ****************/
2468424739
/************** Begin file hwtime.h ******************************************/
24740
+#line 1 "tsrc/hwtime.h"
2468524741
/*
2468624742
** 2008 May 27
2468724743
**
2468824744
** The author disclaims copyright to this source code. In place of
2468924745
** a legal notice, here is a blessing:
@@ -24768,10 +24824,11 @@
2476824824
2476924825
#endif /* !defined(_HWTIME_H_) */
2477024826
2477124827
/************** End of hwtime.h **********************************************/
2477224828
/************** Continuing where we left off in os_common.h ******************/
24829
+#line 53 "tsrc/os_common.h"
2477324830
2477424831
static sqlite_uint64 g_start;
2477524832
static sqlite_uint64 g_elapsed;
2477624833
#define TIMER_START g_start=sqlite3Hwtime()
2477724834
#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -24834,10 +24891,11 @@
2483424891
2483524892
#endif /* !defined(_OS_COMMON_H_) */
2483624893
2483724894
/************** End of os_common.h *******************************************/
2483824895
/************** Continuing where we left off in os_unix.c ********************/
24896
+#line 265 "tsrc/os_unix.c"
2483924897
2484024898
/*
2484124899
** Define various macros that are missing from some systems.
2484224900
*/
2484324901
#ifndef O_LARGEFILE
@@ -31343,10 +31401,11 @@
3134331401
3134431402
#endif /* SQLITE_OS_UNIX */
3134531403
3134631404
/************** End of os_unix.c *********************************************/
3134731405
/************** Begin file os_win.c ******************************************/
31406
+#line 1 "tsrc/os_win.c"
3134831407
/*
3134931408
** 2004 May 22
3135031409
**
3135131410
** The author disclaims copyright to this source code. In place of
3135231411
** a legal notice, here is a blessing:
@@ -31404,10 +31463,11 @@
3140431463
/*
3140531464
** Include code that is common to all os_*.c files
3140631465
*/
3140731466
/************** Include os_common.h in the middle of os_win.c ****************/
3140831467
/************** Begin file os_common.h ***************************************/
31468
+#line 1 "tsrc/os_common.h"
3140931469
/*
3141031470
** 2004 May 22
3141131471
**
3141231472
** The author disclaims copyright to this source code. In place of
3141331473
** a legal notice, here is a blessing:
@@ -31457,10 +31517,11 @@
3145731517
** hwtime.h contains inline assembler code for implementing
3145831518
** high-performance timing routines.
3145931519
*/
3146031520
/************** Include hwtime.h in the middle of os_common.h ****************/
3146131521
/************** Begin file hwtime.h ******************************************/
31522
+#line 1 "tsrc/hwtime.h"
3146231523
/*
3146331524
** 2008 May 27
3146431525
**
3146531526
** The author disclaims copyright to this source code. In place of
3146631527
** a legal notice, here is a blessing:
@@ -31545,10 +31606,11 @@
3154531606
3154631607
#endif /* !defined(_HWTIME_H_) */
3154731608
3154831609
/************** End of hwtime.h **********************************************/
3154931610
/************** Continuing where we left off in os_common.h ******************/
31611
+#line 53 "tsrc/os_common.h"
3155031612
3155131613
static sqlite_uint64 g_start;
3155231614
static sqlite_uint64 g_elapsed;
3155331615
#define TIMER_START g_start=sqlite3Hwtime()
3155431616
#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -31611,10 +31673,11 @@
3161131673
3161231674
#endif /* !defined(_OS_COMMON_H_) */
3161331675
3161431676
/************** End of os_common.h *******************************************/
3161531677
/************** Continuing where we left off in os_win.c *********************/
31678
+#line 62 "tsrc/os_win.c"
3161631679
3161731680
/*
3161831681
** Some microsoft compilers lack this definition.
3161931682
*/
3162031683
#ifndef INVALID_FILE_ATTRIBUTES
@@ -34746,10 +34809,11 @@
3474634809
3474734810
#endif /* SQLITE_OS_WIN */
3474834811
3474934812
/************** End of os_win.c **********************************************/
3475034813
/************** Begin file bitvec.c ******************************************/
34814
+#line 1 "tsrc/bitvec.c"
3475134815
/*
3475234816
** 2008 February 16
3475334817
**
3475434818
** The author disclaims copyright to this source code. In place of
3475534819
** a legal notice, here is a blessing:
@@ -35156,10 +35220,11 @@
3515635220
}
3515735221
#endif /* SQLITE_OMIT_BUILTIN_TEST */
3515835222
3515935223
/************** End of bitvec.c **********************************************/
3516035224
/************** Begin file pcache.c ******************************************/
35225
+#line 1 "tsrc/pcache.c"
3516135226
/*
3516235227
** 2008 August 05
3516335228
**
3516435229
** The author disclaims copyright to this source code. In place of
3516535230
** a legal notice, here is a blessing:
@@ -35752,10 +35817,11 @@
3575235817
}
3575335818
#endif
3575435819
3575535820
/************** End of pcache.c **********************************************/
3575635821
/************** Begin file pcache1.c *****************************************/
35822
+#line 1 "tsrc/pcache1.c"
3575735823
/*
3575835824
** 2008 November 05
3575935825
**
3576035826
** The author disclaims copyright to this source code. In place of
3576135827
** a legal notice, here is a blessing:
@@ -36968,10 +37034,11 @@
3696837034
}
3696937035
#endif
3697037036
3697137037
/************** End of pcache1.c *********************************************/
3697237038
/************** Begin file rowset.c ******************************************/
37039
+#line 1 "tsrc/rowset.c"
3697337040
/*
3697437041
** 2008 December 3
3697537042
**
3697637043
** The author disclaims copyright to this source code. In place of
3697737044
** a legal notice, here is a blessing:
@@ -37392,10 +37459,11 @@
3739237459
return 0;
3739337460
}
3739437461
3739537462
/************** End of rowset.c **********************************************/
3739637463
/************** Begin file pager.c *******************************************/
37464
+#line 1 "tsrc/pager.c"
3739737465
/*
3739837466
** 2001 September 15
3739937467
**
3740037468
** The author disclaims copyright to this source code. In place of
3740137469
** a legal notice, here is a blessing:
@@ -37415,10 +37483,11 @@
3741537483
** another is writing.
3741637484
*/
3741737485
#ifndef SQLITE_OMIT_DISKIO
3741837486
/************** Include wal.h in the middle of pager.c ***********************/
3741937487
/************** Begin file wal.h *********************************************/
37488
+#line 1 "tsrc/wal.h"
3742037489
/*
3742137490
** 2010 February 1
3742237491
**
3742337492
** The author disclaims copyright to this source code. In place of
3742437493
** a legal notice, here is a blessing:
@@ -37539,10 +37608,11 @@
3753937608
#endif /* ifndef SQLITE_OMIT_WAL */
3754037609
#endif /* _WAL_H_ */
3754137610
3754237611
/************** End of wal.h *************************************************/
3754337612
/************** Continuing where we left off in pager.c **********************/
37613
+#line 24 "tsrc/pager.c"
3754437614
3754537615
3754637616
/******************* NOTES ON THE DESIGN OF THE PAGER ************************
3754737617
**
3754837618
** This comment block describes invariants that hold when using a rollback
@@ -44352,10 +44422,11 @@
4435244422
4435344423
#endif /* SQLITE_OMIT_DISKIO */
4435444424
4435544425
/************** End of pager.c ***********************************************/
4435644426
/************** Begin file wal.c *********************************************/
44427
+#line 1 "tsrc/wal.c"
4435744428
/*
4435844429
** 2010 February 1
4435944430
**
4436044431
** The author disclaims copyright to this source code. In place of
4436144432
** a legal notice, here is a blessing:
@@ -47306,10 +47377,11 @@
4730647377
4730747378
#endif /* #ifndef SQLITE_OMIT_WAL */
4730847379
4730947380
/************** End of wal.c *************************************************/
4731047381
/************** Begin file btmutex.c *****************************************/
47382
+#line 1 "tsrc/btmutex.c"
4731147383
/*
4731247384
** 2007 August 27
4731347385
**
4731447386
** The author disclaims copyright to this source code. In place of
4731547387
** a legal notice, here is a blessing:
@@ -47325,10 +47397,11 @@
4732547397
** big and we want to break it down some. This packaged seemed like
4732647398
** a good breakout.
4732747399
*/
4732847400
/************** Include btreeInt.h in the middle of btmutex.c ****************/
4732947401
/************** Begin file btreeInt.h ****************************************/
47402
+#line 1 "tsrc/btreeInt.h"
4733047403
/*
4733147404
** 2004 April 6
4733247405
**
4733347406
** The author disclaims copyright to this source code. In place of
4733447407
** a legal notice, here is a blessing:
@@ -47970,10 +48043,11 @@
4797048043
#define get4byte sqlite3Get4byte
4797148044
#define put4byte sqlite3Put4byte
4797248045
4797348046
/************** End of btreeInt.h ********************************************/
4797448047
/************** Continuing where we left off in btmutex.c ********************/
48048
+#line 19 "tsrc/btmutex.c"
4797548049
#ifndef SQLITE_OMIT_SHARED_CACHE
4797648050
#if SQLITE_THREADSAFE
4797748051
4797848052
/*
4797948053
** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -48242,10 +48316,11 @@
4824248316
#endif /* if SQLITE_THREADSAFE */
4824348317
#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
4824448318
4824548319
/************** End of btmutex.c *********************************************/
4824648320
/************** Begin file btree.c *******************************************/
48321
+#line 1 "tsrc/btree.c"
4824748322
/*
4824848323
** 2004 April 6
4824948324
**
4825048325
** The author disclaims copyright to this source code. In place of
4825148326
** a legal notice, here is a blessing:
@@ -48899,22 +48974,25 @@
4889948974
int *pRes /* Write search results here */
4890048975
){
4890148976
int rc; /* Status code */
4890248977
UnpackedRecord *pIdxKey; /* Unpacked index key */
4890348978
char aSpace[150]; /* Temp space for pIdxKey - to avoid a malloc */
48979
+ char *pFree = 0;
4890448980
4890548981
if( pKey ){
4890648982
assert( nKey==(i64)(int)nKey );
48907
- pIdxKey = sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey,
48908
- aSpace, sizeof(aSpace));
48983
+ pIdxKey = sqlite3VdbeAllocUnpackedRecord(
48984
+ pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
48985
+ );
4890948986
if( pIdxKey==0 ) return SQLITE_NOMEM;
48987
+ sqlite3VdbeRecordUnpack(pCur->pKeyInfo, nKey, pKey, pIdxKey);
4891048988
}else{
4891148989
pIdxKey = 0;
4891248990
}
4891348991
rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
48914
- if( pKey ){
48915
- sqlite3VdbeDeleteUnpackedRecord(pIdxKey);
48992
+ if( pFree ){
48993
+ sqlite3DbFree(pCur->pKeyInfo->db, pFree);
4891648994
}
4891748995
return rc;
4891848996
}
4891948997
4892048998
/*
@@ -56426,10 +56504,11 @@
5642656504
return rc;
5642756505
}
5642856506
5642956507
/************** End of btree.c ***********************************************/
5643056508
/************** Begin file backup.c ******************************************/
56509
+#line 1 "tsrc/backup.c"
5643156510
/*
5643256511
** 2009 January 28
5643356512
**
5643456513
** The author disclaims copyright to this source code. In place of
5643556514
** a legal notice, here is a blessing:
@@ -57132,10 +57211,11 @@
5713257211
}
5713357212
#endif /* SQLITE_OMIT_VACUUM */
5713457213
5713557214
/************** End of backup.c **********************************************/
5713657215
/************** Begin file vdbemem.c *****************************************/
57216
+#line 1 "tsrc/vdbemem.c"
5713757217
/*
5713857218
** 2004 May 26
5713957219
**
5714057220
** The author disclaims copyright to this source code. In place of
5714157221
** a legal notice, here is a blessing:
@@ -58286,10 +58366,11 @@
5828658366
return 0;
5828758367
}
5828858368
5828958369
/************** End of vdbemem.c *********************************************/
5829058370
/************** Begin file vdbeaux.c *****************************************/
58371
+#line 1 "tsrc/vdbeaux.c"
5829158372
/*
5829258373
** 2003 September 6
5829358374
**
5829458375
** The author disclaims copyright to this source code. In place of
5829558376
** a legal notice, here is a blessing:
@@ -61116,61 +61197,74 @@
6111661197
}
6111761198
}
6111861199
return 0;
6111961200
}
6112061201
61121
-
61122
-/*
61123
-** Given the nKey-byte encoding of a record in pKey[], parse the
61124
-** record into a UnpackedRecord structure. Return a pointer to
61125
-** that structure.
61126
-**
61127
-** The calling function might provide szSpace bytes of memory
61128
-** space at pSpace. This space can be used to hold the returned
61129
-** VDbeParsedRecord structure if it is large enough. If it is
61130
-** not big enough, space is obtained from sqlite3_malloc().
61131
-**
61132
-** The returned structure should be closed by a call to
61133
-** sqlite3VdbeDeleteUnpackedRecord().
61134
-*/
61135
-SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(
61136
- KeyInfo *pKeyInfo, /* Information about the record format */
61137
- int nKey, /* Size of the binary record */
61138
- const void *pKey, /* The binary record */
61139
- char *pSpace, /* Unaligned space available to hold the object */
61140
- int szSpace /* Size of pSpace[] in bytes */
61141
-){
61142
- const unsigned char *aKey = (const unsigned char *)pKey;
61143
- UnpackedRecord *p; /* The unpacked record that we will return */
61144
- int nByte; /* Memory space needed to hold p, in bytes */
61145
- int d;
61146
- u32 idx;
61147
- u16 u; /* Unsigned loop counter */
61148
- u32 szHdr;
61149
- Mem *pMem;
61150
- int nOff; /* Increase pSpace by this much to 8-byte align it */
61151
-
61152
- /*
61153
- ** We want to shift the pointer pSpace up such that it is 8-byte aligned.
61202
+/*
61203
+** This routine is used to allocate sufficient space for an UnpackedRecord
61204
+** structure large enough to be used with sqlite3VdbeRecordUnpack() if
61205
+** the first argument is a pointer to KeyInfo structure pKeyInfo.
61206
+**
61207
+** The space is either allocated using sqlite3DbMallocRaw() or from within
61208
+** the unaligned buffer passed via the second and third arguments (presumably
61209
+** stack space). If the former, then *ppFree is set to a pointer that should
61210
+** be eventually freed by the caller using sqlite3DbFree(). Or, if the
61211
+** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL
61212
+** before returning.
61213
+**
61214
+** If an OOM error occurs, NULL is returned.
61215
+*/
61216
+SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
61217
+ KeyInfo *pKeyInfo, /* Description of the record */
61218
+ char *pSpace, /* Unaligned space available */
61219
+ int szSpace, /* Size of pSpace[] in bytes */
61220
+ char **ppFree /* OUT: Caller should free this pointer */
61221
+){
61222
+ UnpackedRecord *p; /* Unpacked record to return */
61223
+ int nOff; /* Increment pSpace by nOff to align it */
61224
+ int nByte; /* Number of bytes required for *p */
61225
+
61226
+ /* We want to shift the pointer pSpace up such that it is 8-byte aligned.
6115461227
** Thus, we need to calculate a value, nOff, between 0 and 7, to shift
6115561228
** it by. If pSpace is already 8-byte aligned, nOff should be zero.
6115661229
*/
6115761230
nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;
61158
- pSpace += nOff;
61159
- szSpace -= nOff;
6116061231
nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
61161
- if( nByte>szSpace ){
61162
- p = sqlite3DbMallocRaw(pKeyInfo->db, nByte);
61163
- if( p==0 ) return 0;
61164
- p->flags = UNPACKED_NEED_FREE | UNPACKED_NEED_DESTROY;
61232
+ if( nByte>szSpace+nOff ){
61233
+ p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
61234
+ *ppFree = (char *)p;
61235
+ if( !p ) return 0;
6116561236
}else{
61166
- p = (UnpackedRecord*)pSpace;
61167
- p->flags = UNPACKED_NEED_DESTROY;
61237
+ p = (UnpackedRecord*)&pSpace[nOff];
61238
+ *ppFree = 0;
6116861239
}
61240
+
61241
+ p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
6116961242
p->pKeyInfo = pKeyInfo;
6117061243
p->nField = pKeyInfo->nField + 1;
61171
- p->aMem = pMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
61244
+ return p;
61245
+}
61246
+
61247
+/*
61248
+** Given the nKey-byte encoding of a record in pKey[], populate the
61249
+** UnpackedRecord structure indicated by the fourth argument with the
61250
+** contents of the decoded record.
61251
+*/
61252
+SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
61253
+ KeyInfo *pKeyInfo, /* Information about the record format */
61254
+ int nKey, /* Size of the binary record */
61255
+ const void *pKey, /* The binary record */
61256
+ UnpackedRecord *p /* Populate this structure before returning. */
61257
+){
61258
+ const unsigned char *aKey = (const unsigned char *)pKey;
61259
+ int d;
61260
+ u32 idx; /* Offset in aKey[] to read from */
61261
+ u16 u; /* Unsigned loop counter */
61262
+ u32 szHdr;
61263
+ Mem *pMem = p->aMem;
61264
+
61265
+ p->flags = 0;
6117261266
assert( EIGHT_BYTE_ALIGNMENT(pMem) );
6117361267
idx = getVarint32(aKey, szHdr);
6117461268
d = szHdr;
6117561269
u = 0;
6117661270
while( idx<szHdr && u<p->nField && d<=nKey ){
@@ -61185,35 +61279,10 @@
6118561279
pMem++;
6118661280
u++;
6118761281
}
6118861282
assert( u<=pKeyInfo->nField + 1 );
6118961283
p->nField = u;
61190
- return (void*)p;
61191
-}
61192
-
61193
-/*
61194
-** This routine destroys a UnpackedRecord object.
61195
-*/
61196
-SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord *p){
61197
-#ifdef SQLITE_DEBUG
61198
- int i;
61199
- Mem *pMem;
61200
-
61201
- assert( p!=0 );
61202
- assert( p->flags & UNPACKED_NEED_DESTROY );
61203
- for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
61204
- /* The unpacked record is always constructed by the
61205
- ** sqlite3VdbeUnpackRecord() function above, which makes all
61206
- ** strings and blobs static. And none of the elements are
61207
- ** ever transformed, so there is never anything to delete.
61208
- */
61209
- if( NEVER(pMem->zMalloc) ) sqlite3VdbeMemRelease(pMem);
61210
- }
61211
-#endif
61212
- if( p->flags & UNPACKED_NEED_FREE ){
61213
- sqlite3DbFree(p->pKeyInfo->db, p);
61214
- }
6121561284
}
6121661285
6121761286
/*
6121861287
** This function compares the two table rows or index records
6121961288
** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
@@ -61540,10 +61609,11 @@
6154061609
}
6154161610
}
6154261611
6154361612
/************** End of vdbeaux.c *********************************************/
6154461613
/************** Begin file vdbeapi.c *****************************************/
61614
+#line 1 "tsrc/vdbeapi.c"
6154561615
/*
6154661616
** 2004 May 26
6154761617
**
6154861618
** The author disclaims copyright to this source code. In place of
6154961619
** a legal notice, here is a blessing:
@@ -62847,10 +62917,11 @@
6284762917
return v;
6284862918
}
6284962919
6285062920
/************** End of vdbeapi.c *********************************************/
6285162921
/************** Begin file vdbetrace.c ***************************************/
62922
+#line 1 "tsrc/vdbetrace.c"
6285262923
/*
6285362924
** 2009 November 25
6285462925
**
6285562926
** The author disclaims copyright to this source code. In place of
6285662927
** a legal notice, here is a blessing:
@@ -63002,10 +63073,11 @@
6300263073
6300363074
#endif /* #ifndef SQLITE_OMIT_TRACE */
6300463075
6300563076
/************** End of vdbetrace.c *******************************************/
6300663077
/************** Begin file vdbe.c ********************************************/
63078
+#line 1 "tsrc/vdbe.c"
6300763079
/*
6300863080
** 2001 September 15
6300963081
**
6301063082
** The author disclaims copyright to this source code. In place of
6301163083
** a legal notice, here is a blessing:
@@ -63471,10 +63543,11 @@
6347163543
** hwtime.h contains inline assembler code for implementing
6347263544
** high-performance timing routines.
6347363545
*/
6347463546
/************** Include hwtime.h in the middle of vdbe.c *********************/
6347563547
/************** Begin file hwtime.h ******************************************/
63548
+#line 1 "tsrc/hwtime.h"
6347663549
/*
6347763550
** 2008 May 27
6347863551
**
6347963552
** The author disclaims copyright to this source code. In place of
6348063553
** a legal notice, here is a blessing:
@@ -63559,10 +63632,11 @@
6355963632
6356063633
#endif /* !defined(_HWTIME_H_) */
6356163634
6356263635
/************** End of hwtime.h **********************************************/
6356363636
/************** Continuing where we left off in vdbe.c ***********************/
63637
+#line 471 "tsrc/vdbe.c"
6356463638
6356563639
#endif
6356663640
6356763641
/*
6356863642
** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
@@ -63853,10 +63927,11 @@
6385363927
} bb;
6385463928
struct OP_Found_stack_vars {
6385563929
int alreadyExists;
6385663930
VdbeCursor *pC;
6385763931
int res;
63932
+ char *pFree;
6385863933
UnpackedRecord *pIdxKey;
6385963934
UnpackedRecord r;
6386063935
char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
6386163936
} bc;
6386263937
struct OP_IsUnique_stack_vars {
@@ -67097,10 +67172,11 @@
6709767172
case OP_Found: { /* jump, in3 */
6709867173
#if 0 /* local variables moved into u.bc */
6709967174
int alreadyExists;
6710067175
VdbeCursor *pC;
6710167176
int res;
67177
+ char *pFree;
6710267178
UnpackedRecord *pIdxKey;
6710367179
UnpackedRecord r;
6710467180
char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
6710567181
#endif /* local variables moved into u.bc */
6710667182
@@ -67125,22 +67201,22 @@
6712567201
{ int i; for(i=0; i<u.bc.r.nField; i++) assert( memIsValid(&u.bc.r.aMem[i]) ); }
6712667202
#endif
6712767203
u.bc.r.flags = UNPACKED_PREFIX_MATCH;
6712867204
u.bc.pIdxKey = &u.bc.r;
6712967205
}else{
67206
+ u.bc.pIdxKey = sqlite3VdbeAllocUnpackedRecord(
67207
+ u.bc.pC->pKeyInfo, u.bc.aTempRec, sizeof(u.bc.aTempRec), &u.bc.pFree
67208
+ );
67209
+ if( u.bc.pIdxKey==0 ) goto no_mem;
6713067210
assert( pIn3->flags & MEM_Blob );
6713167211
assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */
67132
- u.bc.pIdxKey = sqlite3VdbeRecordUnpack(u.bc.pC->pKeyInfo, pIn3->n, pIn3->z,
67133
- u.bc.aTempRec, sizeof(u.bc.aTempRec));
67134
- if( u.bc.pIdxKey==0 ){
67135
- goto no_mem;
67136
- }
67212
+ sqlite3VdbeRecordUnpack(u.bc.pC->pKeyInfo, pIn3->n, pIn3->z, u.bc.pIdxKey);
6713767213
u.bc.pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
6713867214
}
6713967215
rc = sqlite3BtreeMovetoUnpacked(u.bc.pC->pCursor, u.bc.pIdxKey, 0, 0, &u.bc.res);
6714067216
if( pOp->p4.i==0 ){
67141
- sqlite3VdbeDeleteUnpackedRecord(u.bc.pIdxKey);
67217
+ sqlite3DbFree(db, u.bc.pFree);
6714267218
}
6714367219
if( rc!=SQLITE_OK ){
6714467220
break;
6714567221
}
6714667222
u.bc.alreadyExists = (u.bc.res==0);
@@ -69784,10 +69860,11 @@
6978469860
goto vdbe_error_halt;
6978569861
}
6978669862
6978769863
/************** End of vdbe.c ************************************************/
6978869864
/************** Begin file vdbeblob.c ****************************************/
69865
+#line 1 "tsrc/vdbeblob.c"
6978969866
/*
6979069867
** 2007 May 1
6979169868
**
6979269869
** The author disclaims copyright to this source code. In place of
6979369870
** a legal notice, here is a blessing:
@@ -70254,10 +70331,11 @@
7025470331
7025570332
#endif /* #ifndef SQLITE_OMIT_INCRBLOB */
7025670333
7025770334
/************** End of vdbeblob.c ********************************************/
7025870335
/************** Begin file vdbesort.c ****************************************/
70336
+#line 1 "tsrc/vdbesort.c"
7025970337
/*
7026070338
** 2011 July 9
7026170339
**
7026270340
** The author disclaims copyright to this source code. In place of
7026370341
** a legal notice, here is a blessing:
@@ -70358,12 +70436,11 @@
7035870436
sqlite3_file *pTemp1; /* PMA file 1 */
7035970437
int nPMA; /* Number of PMAs stored in pTemp1 */
7036070438
SorterRecord *pRecord; /* Head of in-memory record list */
7036170439
int mnPmaSize; /* Minimum PMA size, in bytes */
7036270440
int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
70363
- char *aSpace; /* Space for UnpackRecord() */
70364
- int nSpace; /* Size of aSpace in bytes */
70441
+ UnpackedRecord *pUnpacked; /* Used to unpack keys */
7036570442
};
7036670443
7036770444
/*
7036870445
** The following type is an iterator for a PMA. It caches the current key in
7036970446
** variables nKey/aKey. If the iterator is at EOF, pFile==0.
@@ -70553,56 +70630,39 @@
7055370630
** be less than key2. Even if key2 also contains NULL values.
7055470631
**
7055570632
** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace
7055670633
** has been allocated and contains an unpacked record that is used as key2.
7055770634
*/
70558
-static int vdbeSorterCompare(
70635
+static void vdbeSorterCompare(
7055970636
VdbeCursor *pCsr, /* Cursor object (for pKeyInfo) */
7056070637
int bOmitRowid, /* Ignore rowid field at end of keys */
7056170638
void *pKey1, int nKey1, /* Left side of comparison */
7056270639
void *pKey2, int nKey2, /* Right side of comparison */
7056370640
int *pRes /* OUT: Result of comparison */
7056470641
){
7056570642
KeyInfo *pKeyInfo = pCsr->pKeyInfo;
7056670643
VdbeSorter *pSorter = pCsr->pSorter;
70567
- char *aSpace = pSorter->aSpace;
70568
- int nSpace = pSorter->nSpace;
70569
- UnpackedRecord *r2;
70644
+ UnpackedRecord *r2 = pSorter->pUnpacked;
7057070645
int i;
7057170646
70572
- if( aSpace==0 ){
70573
- nSpace = ROUND8(sizeof(UnpackedRecord))+(pKeyInfo->nField+1)*sizeof(Mem);
70574
- aSpace = (char *)sqlite3Malloc(nSpace);
70575
- if( aSpace==0 ) return SQLITE_NOMEM;
70576
- pSorter->aSpace = aSpace;
70577
- pSorter->nSpace = nSpace;
70578
- }
70579
-
7058070647
if( pKey2 ){
70581
- /* This call cannot fail. As the memory is already allocated. */
70582
- r2 = sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, aSpace, nSpace);
70583
- assert( r2 && (r2->flags & UNPACKED_NEED_FREE)==0 );
70584
- assert( r2==(UnpackedRecord*)aSpace );
70585
- }else{
70586
- r2 = (UnpackedRecord *)aSpace;
70587
- assert( !bOmitRowid );
70648
+ sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, r2);
7058870649
}
7058970650
7059070651
if( bOmitRowid ){
70591
- for(i=0; i<r2->nField-1; i++){
70652
+ r2->nField = pKeyInfo->nField;
70653
+ assert( r2->nField>0 );
70654
+ for(i=0; i<r2->nField; i++){
7059270655
if( r2->aMem[i].flags & MEM_Null ){
7059370656
*pRes = -1;
70594
- return SQLITE_OK;
70657
+ return;
7059570658
}
7059670659
}
7059770660
r2->flags |= UNPACKED_PREFIX_MATCH;
70598
- r2->nField--;
70599
- assert( r2->nField>0 );
7060070661
}
7060170662
7060270663
*pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
70603
- return SQLITE_OK;
7060470664
}
7060570665
7060670666
/*
7060770667
** This function is called to compare two iterator keys when merging
7060870668
** multiple b-tree segments. Parameter iOut is the index of the aTree[]
@@ -70633,19 +70693,14 @@
7063370693
iRes = i2;
7063470694
}else if( p2->pFile==0 ){
7063570695
iRes = i1;
7063670696
}else{
7063770697
int res;
70638
- int rc;
70639
- assert( pCsr->pSorter->aSpace!=0 ); /* allocated in vdbeSorterMerge() */
70640
- rc = vdbeSorterCompare(
70698
+ assert( pCsr->pSorter->pUnpacked!=0 ); /* allocated in vdbeSorterMerge() */
70699
+ vdbeSorterCompare(
7064170700
pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res
7064270701
);
70643
- /* The vdbeSorterCompare() call cannot fail since pCsr->pSorter->aSpace
70644
- ** has already been allocated. */
70645
- assert( rc==SQLITE_OK );
70646
-
7064770702
if( res<=0 ){
7064870703
iRes = i1;
7064970704
}else{
7065070705
iRes = i2;
7065170706
}
@@ -70660,16 +70715,21 @@
7066070715
*/
7066170716
SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
7066270717
int pgsz; /* Page size of main database */
7066370718
int mxCache; /* Cache size */
7066470719
VdbeSorter *pSorter; /* The new sorter */
70720
+ char *d; /* Dummy */
7066570721
7066670722
assert( pCsr->pKeyInfo && pCsr->pBt==0 );
7066770723
pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
7066870724
if( pSorter==0 ){
7066970725
return SQLITE_NOMEM;
7067070726
}
70727
+
70728
+ pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pCsr->pKeyInfo, 0, 0, &d);
70729
+ if( pSorter->pUnpacked==0 ) return SQLITE_NOMEM;
70730
+ assert( pSorter->pUnpacked==(UnpackedRecord *)d );
7067170731
7067270732
if( !sqlite3TempInMemory(db) ){
7067370733
pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
7067470734
pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
7067570735
mxCache = db->aDb[0].pSchema->cache_size;
@@ -70707,11 +70767,11 @@
7070770767
}
7070870768
if( pSorter->pTemp1 ){
7070970769
sqlite3OsCloseFree(pSorter->pTemp1);
7071070770
}
7071170771
vdbeSorterRecordFree(db, pSorter->pRecord);
70712
- sqlite3_free(pSorter->aSpace);
70772
+ sqlite3DbFree(db, pSorter->pUnpacked);
7071370773
sqlite3DbFree(db, pSorter);
7071470774
pCsr->pSorter = 0;
7071570775
}
7071670776
}
7071770777
@@ -70728,36 +70788,26 @@
7072870788
SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE, &dummy
7072970789
);
7073070790
}
7073170791
7073270792
/*
70733
-** Attemp to merge the two sorted lists p1 and p2 into a single list. If no
70734
-** error occurs set *ppOut to the head of the new list and return SQLITE_OK.
70793
+** Merge the two sorted lists p1 and p2 into a single list.
70794
+** Set *ppOut to the head of the new list.
7073570795
*/
70736
-static int vdbeSorterMerge(
70737
- sqlite3 *db, /* Database handle */
70796
+static void vdbeSorterMerge(
7073870797
VdbeCursor *pCsr, /* For pKeyInfo */
7073970798
SorterRecord *p1, /* First list to merge */
7074070799
SorterRecord *p2, /* Second list to merge */
7074170800
SorterRecord **ppOut /* OUT: Head of merged list */
7074270801
){
70743
- int rc = SQLITE_OK;
7074470802
SorterRecord *pFinal = 0;
7074570803
SorterRecord **pp = &pFinal;
7074670804
void *pVal2 = p2 ? p2->pVal : 0;
7074770805
7074870806
while( p1 && p2 ){
7074970807
int res;
70750
- rc = vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);
70751
- if( rc!=SQLITE_OK ){
70752
- *pp = 0;
70753
- vdbeSorterRecordFree(db, p1);
70754
- vdbeSorterRecordFree(db, p2);
70755
- vdbeSorterRecordFree(db, pFinal);
70756
- *ppOut = 0;
70757
- return rc;
70758
- }
70808
+ vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);
7075970809
if( res<=0 ){
7076070810
*pp = p1;
7076170811
pp = &p1->pNext;
7076270812
p1 = p1->pNext;
7076370813
pVal2 = 0;
@@ -70768,22 +70818,19 @@
7076870818
if( p2==0 ) break;
7076970819
pVal2 = p2->pVal;
7077070820
}
7077170821
}
7077270822
*pp = p1 ? p1 : p2;
70773
-
7077470823
*ppOut = pFinal;
70775
- return SQLITE_OK;
7077670824
}
7077770825
7077870826
/*
7077970827
** Sort the linked list of records headed at pCsr->pRecord. Return SQLITE_OK
7078070828
** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error
7078170829
** occurs.
7078270830
*/
70783
-static int vdbeSorterSort(sqlite3 *db, VdbeCursor *pCsr){
70784
- int rc = SQLITE_OK;
70831
+static int vdbeSorterSort(VdbeCursor *pCsr){
7078570832
int i;
7078670833
SorterRecord **aSlot;
7078770834
SorterRecord *p;
7078870835
VdbeSorter *pSorter = pCsr->pSorter;
7078970836
@@ -70794,34 +70841,26 @@
7079470841
7079570842
p = pSorter->pRecord;
7079670843
while( p ){
7079770844
SorterRecord *pNext = p->pNext;
7079870845
p->pNext = 0;
70799
- for(i=0; rc==SQLITE_OK && aSlot[i]; i++){
70800
- rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p);
70846
+ for(i=0; aSlot[i]; i++){
70847
+ vdbeSorterMerge(pCsr, p, aSlot[i], &p);
7080170848
aSlot[i] = 0;
7080270849
}
70803
- if( rc!=SQLITE_OK ){
70804
- vdbeSorterRecordFree(db, pNext);
70805
- break;
70806
- }
7080770850
aSlot[i] = p;
7080870851
p = pNext;
7080970852
}
7081070853
7081170854
p = 0;
7081270855
for(i=0; i<64; i++){
70813
- if( rc==SQLITE_OK ){
70814
- rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p);
70815
- }else{
70816
- vdbeSorterRecordFree(db, aSlot[i]);
70817
- }
70856
+ vdbeSorterMerge(pCsr, p, aSlot[i], &p);
7081870857
}
7081970858
pSorter->pRecord = p;
7082070859
7082170860
sqlite3_free(aSlot);
70822
- return rc;
70861
+ return SQLITE_OK;
7082370862
}
7082470863
7082570864
7082670865
/*
7082770866
** Write the current contents of the in-memory linked-list to a PMA. Return
@@ -70843,11 +70882,11 @@
7084370882
if( pSorter->nInMemory==0 ){
7084470883
assert( pSorter->pRecord==0 );
7084570884
return rc;
7084670885
}
7084770886
70848
- rc = vdbeSorterSort(db, pCsr);
70887
+ rc = vdbeSorterSort(pCsr);
7084970888
7085070889
/* If the first temporary PMA file has not been opened, open it now. */
7085170890
if( rc==SQLITE_OK && pSorter->pTemp1==0 ){
7085270891
rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);
7085370892
assert( rc!=SQLITE_OK || pSorter->pTemp1 );
@@ -70990,11 +71029,11 @@
7099071029
** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly
7099171030
** from the in-memory list. */
7099271031
if( pSorter->nPMA==0 ){
7099371032
*pbEof = !pSorter->pRecord;
7099471033
assert( pSorter->aTree==0 );
70995
- return vdbeSorterSort(db, pCsr);
71034
+ return vdbeSorterSort(pCsr);
7099671035
}
7099771036
7099871037
/* Write the current b-tree to a PMA. Close the b-tree cursor. */
7099971038
rc = vdbeSorterListToPMA(db, pCsr);
7100071039
if( rc!=SQLITE_OK ) return rc;
@@ -71160,24 +71199,23 @@
7116071199
SQLITE_PRIVATE int sqlite3VdbeSorterCompare(
7116171200
VdbeCursor *pCsr, /* Sorter cursor */
7116271201
Mem *pVal, /* Value to compare to current sorter key */
7116371202
int *pRes /* OUT: Result of comparison */
7116471203
){
71165
- int rc;
7116671204
VdbeSorter *pSorter = pCsr->pSorter;
7116771205
void *pKey; int nKey; /* Sorter key to compare pVal with */
7116871206
7116971207
pKey = vdbeSorterRowkey(pSorter, &nKey);
71170
- rc = vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
71171
- assert( rc!=SQLITE_OK || pVal->db->mallocFailed || (*pRes)<=0 );
71172
- return rc;
71208
+ vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
71209
+ return SQLITE_OK;
7117371210
}
7117471211
7117571212
#endif /* #ifndef SQLITE_OMIT_MERGE_SORT */
7117671213
7117771214
/************** End of vdbesort.c ********************************************/
7117871215
/************** Begin file journal.c *****************************************/
71216
+#line 1 "tsrc/journal.c"
7117971217
/*
7118071218
** 2007 August 22
7118171219
**
7118271220
** The author disclaims copyright to this source code. In place of
7118371221
** a legal notice, here is a blessing:
@@ -71414,10 +71452,11 @@
7141471452
}
7141571453
#endif
7141671454
7141771455
/************** End of journal.c *********************************************/
7141871456
/************** Begin file memjournal.c **************************************/
71457
+#line 1 "tsrc/memjournal.c"
7141971458
/*
7142071459
** 2008 October 7
7142171460
**
7142271461
** The author disclaims copyright to this source code. In place of
7142371462
** a legal notice, here is a blessing:
@@ -71675,10 +71714,11 @@
7167571714
return sizeof(MemJournal);
7167671715
}
7167771716
7167871717
/************** End of memjournal.c ******************************************/
7167971718
/************** Begin file walker.c ******************************************/
71719
+#line 1 "tsrc/walker.c"
7168071720
/*
7168171721
** 2008 August 16
7168271722
**
7168371723
** The author disclaims copyright to this source code. In place of
7168471724
** a legal notice, here is a blessing:
@@ -71813,10 +71853,11 @@
7181371853
return rc & WRC_Abort;
7181471854
}
7181571855
7181671856
/************** End of walker.c **********************************************/
7181771857
/************** Begin file resolve.c *****************************************/
71858
+#line 1 "tsrc/resolve.c"
7181871859
/*
7181971860
** 2008 August 18
7182071861
**
7182171862
** The author disclaims copyright to this source code. In place of
7182271863
** a legal notice, here is a blessing:
@@ -73033,10 +73074,11 @@
7303373074
sqlite3WalkSelect(&w, p);
7303473075
}
7303573076
7303673077
/************** End of resolve.c *********************************************/
7303773078
/************** Begin file expr.c ********************************************/
73079
+#line 1 "tsrc/expr.c"
7303873080
/*
7303973081
** 2001 September 15
7304073082
**
7304173083
** The author disclaims copyright to this source code. In place of
7304273084
** a legal notice, here is a blessing:
@@ -76793,10 +76835,11 @@
7679376835
}
7679476836
}
7679576837
7679676838
/************** End of expr.c ************************************************/
7679776839
/************** Begin file alter.c *******************************************/
76840
+#line 1 "tsrc/alter.c"
7679876841
/*
7679976842
** 2005 February 15
7680076843
**
7680176844
** The author disclaims copyright to this source code. In place of
7680276845
** a legal notice, here is a blessing:
@@ -77621,10 +77664,11 @@
7762177664
}
7762277665
#endif /* SQLITE_ALTER_TABLE */
7762377666
7762477667
/************** End of alter.c ***********************************************/
7762577668
/************** Begin file analyze.c *****************************************/
77669
+#line 1 "tsrc/analyze.c"
7762677670
/*
7762777671
** 2005 July 8
7762877672
**
7762977673
** The author disclaims copyright to this source code. In place of
7763077674
** a legal notice, here is a blessing:
@@ -78342,10 +78386,11 @@
7834278386
7834378387
#endif /* SQLITE_OMIT_ANALYZE */
7834478388
7834578389
/************** End of analyze.c *********************************************/
7834678390
/************** Begin file attach.c ******************************************/
78391
+#line 1 "tsrc/attach.c"
7834778392
/*
7834878393
** 2003 April 6
7834978394
**
7835078395
** The author disclaims copyright to this source code. In place of
7835178396
** a legal notice, here is a blessing:
@@ -78901,10 +78946,11 @@
7890178946
}
7890278947
#endif
7890378948
7890478949
/************** End of attach.c **********************************************/
7890578950
/************** Begin file auth.c ********************************************/
78951
+#line 1 "tsrc/auth.c"
7890678952
/*
7890778953
** 2003 January 11
7890878954
**
7890978955
** The author disclaims copyright to this source code. In place of
7891078956
** a legal notice, here is a blessing:
@@ -79152,10 +79198,11 @@
7915279198
7915379199
#endif /* SQLITE_OMIT_AUTHORIZATION */
7915479200
7915579201
/************** End of auth.c ************************************************/
7915679202
/************** Begin file build.c *******************************************/
79203
+#line 1 "tsrc/build.c"
7915779204
/*
7915879205
** 2001 September 15
7915979206
**
7916079207
** The author disclaims copyright to this source code. In place of
7916179208
** a legal notice, here is a blessing:
@@ -82955,10 +83002,11 @@
8295583002
return pKey;
8295683003
}
8295783004
8295883005
/************** End of build.c ***********************************************/
8295983006
/************** Begin file callback.c ****************************************/
83007
+#line 1 "tsrc/callback.c"
8296083008
/*
8296183009
** 2005 May 23
8296283010
**
8296383011
** The author disclaims copyright to this source code. In place of
8296483012
** a legal notice, here is a blessing:
@@ -83414,10 +83462,11 @@
8341483462
return p;
8341583463
}
8341683464
8341783465
/************** End of callback.c ********************************************/
8341883466
/************** Begin file delete.c ******************************************/
83467
+#line 1 "tsrc/delete.c"
8341983468
/*
8342083469
** 2001 September 15
8342183470
**
8342283471
** The author disclaims copyright to this source code. In place of
8342383472
** a legal notice, here is a blessing:
@@ -84068,10 +84117,11 @@
8406884117
return regBase;
8406984118
}
8407084119
8407184120
/************** End of delete.c **********************************************/
8407284121
/************** Begin file func.c ********************************************/
84122
+#line 1 "tsrc/func.c"
8407384123
/*
8407484124
** 2002 February 23
8407584125
**
8407684126
** The author disclaims copyright to this source code. In place of
8407784127
** a legal notice, here is a blessing:
@@ -85676,10 +85726,11 @@
8567685726
#endif
8567785727
}
8567885728
8567985729
/************** End of func.c ************************************************/
8568085730
/************** Begin file fkey.c ********************************************/
85731
+#line 1 "tsrc/fkey.c"
8568185732
/*
8568285733
**
8568385734
** The author disclaims copyright to this source code. In place of
8568485735
** a legal notice, here is a blessing:
8568585736
**
@@ -86896,10 +86947,11 @@
8689686947
}
8689786948
#endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
8689886949
8689986950
/************** End of fkey.c ************************************************/
8690086951
/************** Begin file insert.c ******************************************/
86952
+#line 1 "tsrc/insert.c"
8690186953
/*
8690286954
** 2001 September 15
8690386955
**
8690486956
** The author disclaims copyright to this source code. In place of
8690586957
** a legal notice, here is a blessing:
@@ -88741,10 +88793,11 @@
8874188793
}
8874288794
#endif /* SQLITE_OMIT_XFER_OPT */
8874388795
8874488796
/************** End of insert.c **********************************************/
8874588797
/************** Begin file legacy.c ******************************************/
88798
+#line 1 "tsrc/legacy.c"
8874688799
/*
8874788800
** 2001 September 15
8874888801
**
8874988802
** The author disclaims copyright to this source code. In place of
8875088803
** a legal notice, here is a blessing:
@@ -88888,10 +88941,11 @@
8888888941
return rc;
8888988942
}
8889088943
8889188944
/************** End of legacy.c **********************************************/
8889288945
/************** Begin file loadext.c *****************************************/
88946
+#line 1 "tsrc/loadext.c"
8889388947
/*
8889488948
** 2006 June 7
8889588949
**
8889688950
** The author disclaims copyright to this source code. In place of
8889788951
** a legal notice, here is a blessing:
@@ -88908,10 +88962,11 @@
8890888962
#ifndef SQLITE_CORE
8890988963
#define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
8891088964
#endif
8891188965
/************** Include sqlite3ext.h in the middle of loadext.c **************/
8891288966
/************** Begin file sqlite3ext.h **************************************/
88967
+#line 1 "tsrc/sqlite3ext.h"
8891388968
/*
8891488969
** 2006 June 7
8891588970
**
8891688971
** The author disclaims copyright to this source code. In place of
8891788972
** a legal notice, here is a blessing:
@@ -89336,10 +89391,11 @@
8933689391
8933789392
#endif /* _SQLITE3EXT_H_ */
8933889393
8933989394
/************** End of sqlite3ext.h ******************************************/
8934089395
/************** Continuing where we left off in loadext.c ********************/
89396
+#line 20 "tsrc/loadext.c"
8934189397
/* #include <string.h> */
8934289398
8934389399
#ifndef SQLITE_OMIT_LOAD_EXTENSION
8934489400
8934589401
/*
@@ -89975,10 +90031,11 @@
8997590031
}
8997690032
}
8997790033
8997890034
/************** End of loadext.c *********************************************/
8997990035
/************** Begin file pragma.c ******************************************/
90036
+#line 1 "tsrc/pragma.c"
8998090037
/*
8998190038
** 2003 April 6
8998290039
**
8998390040
** The author disclaims copyright to this source code. In place of
8998490041
** a legal notice, here is a blessing:
@@ -91503,10 +91560,11 @@
9150391560
9150491561
#endif /* SQLITE_OMIT_PRAGMA */
9150591562
9150691563
/************** End of pragma.c **********************************************/
9150791564
/************** Begin file prepare.c *****************************************/
91565
+#line 1 "tsrc/prepare.c"
9150891566
/*
9150991567
** 2005 May 25
9151091568
**
9151191569
** The author disclaims copyright to this source code. In place of
9151291570
** a legal notice, here is a blessing:
@@ -92363,10 +92421,11 @@
9236392421
9236492422
#endif /* SQLITE_OMIT_UTF16 */
9236592423
9236692424
/************** End of prepare.c *********************************************/
9236792425
/************** Begin file select.c ******************************************/
92426
+#line 1 "tsrc/select.c"
9236892427
/*
9236992428
** 2001 September 15
9237092429
**
9237192430
** The author disclaims copyright to this source code. In place of
9237292431
** a legal notice, here is a blessing:
@@ -96922,10 +96981,11 @@
9692296981
*****************************************************************************/
9692396982
#endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
9692496983
9692596984
/************** End of select.c **********************************************/
9692696985
/************** Begin file table.c *******************************************/
96986
+#line 1 "tsrc/table.c"
9692796987
/*
9692896988
** 2001 September 15
9692996989
**
9693096990
** The author disclaims copyright to this source code. In place of
9693196991
** a legal notice, here is a blessing:
@@ -97121,10 +97181,11 @@
9712197181
9712297182
#endif /* SQLITE_OMIT_GET_TABLE */
9712397183
9712497184
/************** End of table.c ***********************************************/
9712597185
/************** Begin file trigger.c *****************************************/
97186
+#line 1 "tsrc/trigger.c"
9712697187
/*
9712797188
**
9712897189
** The author disclaims copyright to this source code. In place of
9712997190
** a legal notice, here is a blessing:
9713097191
**
@@ -98246,10 +98307,11 @@
9824698307
9824798308
#endif /* !defined(SQLITE_OMIT_TRIGGER) */
9824898309
9824998310
/************** End of trigger.c *********************************************/
9825098311
/************** Begin file update.c ******************************************/
98312
+#line 1 "tsrc/update.c"
9825198313
/*
9825298314
** 2001 September 15
9825398315
**
9825498316
** The author disclaims copyright to this source code. In place of
9825598317
** a legal notice, here is a blessing:
@@ -98918,10 +98980,11 @@
9891898980
}
9891998981
#endif /* SQLITE_OMIT_VIRTUALTABLE */
9892098982
9892198983
/************** End of update.c **********************************************/
9892298984
/************** Begin file vacuum.c ******************************************/
98985
+#line 1 "tsrc/vacuum.c"
9892398986
/*
9892498987
** 2003 April 6
9892598988
**
9892698989
** The author disclaims copyright to this source code. In place of
9892798990
** a legal notice, here is a blessing:
@@ -99264,10 +99327,11 @@
9926499327
9926599328
#endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
9926699329
9926799330
/************** End of vacuum.c **********************************************/
9926899331
/************** Begin file vtab.c ********************************************/
99332
+#line 1 "tsrc/vtab.c"
9926999333
/*
9927099334
** 2006 June 10
9927199335
**
9927299336
** The author disclaims copyright to this source code. In place of
9927399337
** a legal notice, here is a blessing:
@@ -100332,10 +100396,11 @@
100332100396
100333100397
#endif /* SQLITE_OMIT_VIRTUALTABLE */
100334100398
100335100399
/************** End of vtab.c ************************************************/
100336100400
/************** Begin file where.c *******************************************/
100401
+#line 1 "tsrc/where.c"
100337100402
/*
100338100403
** 2001 September 15
100339100404
**
100340100405
** The author disclaims copyright to this source code. In place of
100341100406
** a legal notice, here is a blessing:
@@ -105518,10 +105583,11 @@
105518105583
return;
105519105584
}
105520105585
105521105586
/************** End of where.c ***********************************************/
105522105587
/************** Begin file parse.c *******************************************/
105588
+#line 1 "tsrc/parse.c"
105523105589
/* Driver template for the LEMON parser generator.
105524105590
** The author disclaims copyright to this source code.
105525105591
**
105526105592
** This version of "lempar.c" is modified, slightly, for use by SQLite.
105527105593
** The only modifications are the addition of a couple of NEVER()
@@ -105530,10 +105596,11 @@
105530105596
** specific grammar used by SQLite.
105531105597
*/
105532105598
/* First off, code is included that follows the "include" declaration
105533105599
** in the input grammar file. */
105534105600
/* #include <stdio.h> */
105601
+#line 51 "parse.y"
105535105602
105536105603
105537105604
/*
105538105605
** Disable all error recovery processing in the parser push-down
105539105606
** automaton.
@@ -105577,10 +105644,11 @@
105577105644
/*
105578105645
** An instance of this structure holds the ATTACH key and the key type.
105579105646
*/
105580105647
struct AttachKey { int type; Token key; };
105581105648
105649
+#line 722 "parse.y"
105582105650
105583105651
/* This is a utility routine used to set the ExprSpan.zStart and
105584105652
** ExprSpan.zEnd values of pOut so that the span covers the complete
105585105653
** range of text beginning with pStart and going to the end of pEnd.
105586105654
*/
@@ -105596,10 +105664,11 @@
105596105664
static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){
105597105665
pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue);
105598105666
pOut->zStart = pValue->z;
105599105667
pOut->zEnd = &pValue->z[pValue->n];
105600105668
}
105669
+#line 817 "parse.y"
105601105670
105602105671
/* This routine constructs a binary expression node out of two ExprSpan
105603105672
** objects and uses the result to populate a new ExprSpan object.
105604105673
*/
105605105674
static void spanBinaryExpr(
@@ -105611,10 +105680,11 @@
105611105680
){
105612105681
pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);
105613105682
pOut->zStart = pLeft->zStart;
105614105683
pOut->zEnd = pRight->zEnd;
105615105684
}
105685
+#line 873 "parse.y"
105616105686
105617105687
/* Construct an expression node for a unary postfix operator
105618105688
*/
105619105689
static void spanUnaryPostfix(
105620105690
ExprSpan *pOut, /* Write the new expression node here */
@@ -105625,10 +105695,11 @@
105625105695
){
105626105696
pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105627105697
pOut->zStart = pOperand->zStart;
105628105698
pOut->zEnd = &pPostOp->z[pPostOp->n];
105629105699
}
105700
+#line 892 "parse.y"
105630105701
105631105702
/* A routine to convert a binary TK_IS or TK_ISNOT expression into a
105632105703
** unary TK_ISNULL or TK_NOTNULL expression. */
105633105704
static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
105634105705
sqlite3 *db = pParse->db;
@@ -105636,10 +105707,11 @@
105636105707
pA->op = (u8)op;
105637105708
sqlite3ExprDelete(db, pA->pRight);
105638105709
pA->pRight = 0;
105639105710
}
105640105711
}
105712
+#line 920 "parse.y"
105641105713
105642105714
/* Construct an expression node for a unary prefix operator
105643105715
*/
105644105716
static void spanUnaryPrefix(
105645105717
ExprSpan *pOut, /* Write the new expression node here */
@@ -105650,10 +105722,11 @@
105650105722
){
105651105723
pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105652105724
pOut->zStart = pPreOp->z;
105653105725
pOut->zEnd = pOperand->zEnd;
105654105726
}
105727
+#line 141 "parse.c"
105655105728
/* Next is all token values, in a form suitable for use by makeheaders.
105656105729
** This section will be null unless lemon is run with the -m switch.
105657105730
*/
105658105731
/*
105659105732
** These constants (all generated automatically by the parser generator)
@@ -106905,17 +106978,21 @@
106905106978
** inside the C code.
106906106979
*/
106907106980
case 160: /* select */
106908106981
case 194: /* oneselect */
106909106982
{
106983
+#line 403 "parse.y"
106910106984
sqlite3SelectDelete(pParse->db, (yypminor->yy387));
106985
+#line 1399 "parse.c"
106911106986
}
106912106987
break;
106913106988
case 174: /* term */
106914106989
case 175: /* expr */
106915106990
{
106991
+#line 720 "parse.y"
106916106992
sqlite3ExprDelete(pParse->db, (yypminor->yy118).pExpr);
106993
+#line 1407 "parse.c"
106917106994
}
106918106995
break;
106919106996
case 179: /* idxlist_opt */
106920106997
case 187: /* idxlist */
106921106998
case 197: /* selcollist */
@@ -106927,19 +107004,23 @@
106927107004
case 217: /* setlist */
106928107005
case 220: /* itemlist */
106929107006
case 221: /* exprlist */
106930107007
case 226: /* case_exprlist */
106931107008
{
107009
+#line 1103 "parse.y"
106932107010
sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
107011
+#line 1425 "parse.c"
106933107012
}
106934107013
break;
106935107014
case 193: /* fullname */
106936107015
case 198: /* from */
106937107016
case 206: /* seltablist */
106938107017
case 207: /* stl_prefix */
106939107018
{
107019
+#line 534 "parse.y"
106940107020
sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
107021
+#line 1435 "parse.c"
106941107022
}
106942107023
break;
106943107024
case 199: /* where_opt */
106944107025
case 201: /* having_opt */
106945107026
case 210: /* on_opt */
@@ -106947,29 +107028,37 @@
106947107028
case 225: /* case_operand */
106948107029
case 227: /* case_else */
106949107030
case 238: /* when_clause */
106950107031
case 243: /* key_opt */
106951107032
{
107033
+#line 644 "parse.y"
106952107034
sqlite3ExprDelete(pParse->db, (yypminor->yy314));
107035
+#line 1449 "parse.c"
106953107036
}
106954107037
break;
106955107038
case 211: /* using_opt */
106956107039
case 213: /* inscollist */
106957107040
case 219: /* inscollist_opt */
106958107041
{
107042
+#line 566 "parse.y"
106959107043
sqlite3IdListDelete(pParse->db, (yypminor->yy384));
107044
+#line 1458 "parse.c"
106960107045
}
106961107046
break;
106962107047
case 234: /* trigger_cmd_list */
106963107048
case 239: /* trigger_cmd */
106964107049
{
107050
+#line 1210 "parse.y"
106965107051
sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
107052
+#line 1466 "parse.c"
106966107053
}
106967107054
break;
106968107055
case 236: /* trigger_event */
106969107056
{
107057
+#line 1196 "parse.y"
106970107058
sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
107059
+#line 1473 "parse.c"
106971107060
}
106972107061
break;
106973107062
default: break; /* If no destructor action specified: do nothing */
106974107063
}
106975107064
}
@@ -107151,14 +107240,16 @@
107151107240
}
107152107241
#endif
107153107242
while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
107154107243
/* Here code is inserted which will execute if the parser
107155107244
** stack every overflows */
107245
+#line 38 "parse.y"
107156107246
107157107247
UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */
107158107248
sqlite3ErrorMsg(pParse, "parser stack overflow");
107159107249
pParse->parseError = 1;
107250
+#line 1664 "parse.c"
107160107251
sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
107161107252
}
107162107253
107163107254
/*
107164107255
** Perform a shift action.
@@ -107595,66 +107686,94 @@
107595107686
** { ... } // User supplied code
107596107687
** #line <lineno> <thisfile>
107597107688
** break;
107598107689
*/
107599107690
case 5: /* explain ::= */
107691
+#line 107 "parse.y"
107600107692
{ sqlite3BeginParse(pParse, 0); }
107693
+#line 2107 "parse.c"
107601107694
break;
107602107695
case 6: /* explain ::= EXPLAIN */
107696
+#line 109 "parse.y"
107603107697
{ sqlite3BeginParse(pParse, 1); }
107698
+#line 2112 "parse.c"
107604107699
break;
107605107700
case 7: /* explain ::= EXPLAIN QUERY PLAN */
107701
+#line 110 "parse.y"
107606107702
{ sqlite3BeginParse(pParse, 2); }
107703
+#line 2117 "parse.c"
107607107704
break;
107608107705
case 8: /* cmdx ::= cmd */
107706
+#line 112 "parse.y"
107609107707
{ sqlite3FinishCoding(pParse); }
107708
+#line 2122 "parse.c"
107610107709
break;
107611107710
case 9: /* cmd ::= BEGIN transtype trans_opt */
107711
+#line 117 "parse.y"
107612107712
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
107713
+#line 2127 "parse.c"
107613107714
break;
107614107715
case 13: /* transtype ::= */
107716
+#line 122 "parse.y"
107615107717
{yygotominor.yy4 = TK_DEFERRED;}
107718
+#line 2132 "parse.c"
107616107719
break;
107617107720
case 14: /* transtype ::= DEFERRED */
107618107721
case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
107619107722
case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
107620107723
case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
107621107724
case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
107725
+#line 123 "parse.y"
107622107726
{yygotominor.yy4 = yymsp[0].major;}
107727
+#line 2141 "parse.c"
107623107728
break;
107624107729
case 17: /* cmd ::= COMMIT trans_opt */
107625107730
case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
107731
+#line 126 "parse.y"
107626107732
{sqlite3CommitTransaction(pParse);}
107733
+#line 2147 "parse.c"
107627107734
break;
107628107735
case 19: /* cmd ::= ROLLBACK trans_opt */
107736
+#line 128 "parse.y"
107629107737
{sqlite3RollbackTransaction(pParse);}
107738
+#line 2152 "parse.c"
107630107739
break;
107631107740
case 22: /* cmd ::= SAVEPOINT nm */
107741
+#line 132 "parse.y"
107632107742
{
107633107743
sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
107634107744
}
107745
+#line 2159 "parse.c"
107635107746
break;
107636107747
case 23: /* cmd ::= RELEASE savepoint_opt nm */
107748
+#line 135 "parse.y"
107637107749
{
107638107750
sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
107639107751
}
107752
+#line 2166 "parse.c"
107640107753
break;
107641107754
case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
107755
+#line 138 "parse.y"
107642107756
{
107643107757
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
107644107758
}
107759
+#line 2173 "parse.c"
107645107760
break;
107646107761
case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
107762
+#line 145 "parse.y"
107647107763
{
107648107764
sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
107649107765
}
107766
+#line 2180 "parse.c"
107650107767
break;
107651107768
case 27: /* createkw ::= CREATE */
107769
+#line 148 "parse.y"
107652107770
{
107653107771
pParse->db->lookaside.bEnabled = 0;
107654107772
yygotominor.yy0 = yymsp[0].minor.yy0;
107655107773
}
107774
+#line 2188 "parse.c"
107656107775
break;
107657107776
case 28: /* ifnotexists ::= */
107658107777
case 31: /* temp ::= */ yytestcase(yyruleno==31);
107659107778
case 70: /* autoinc ::= */ yytestcase(yyruleno==70);
107660107779
case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==83);
@@ -107664,44 +107783,56 @@
107664107783
case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
107665107784
case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
107666107785
case 121: /* distinct ::= */ yytestcase(yyruleno==121);
107667107786
case 222: /* between_op ::= BETWEEN */ yytestcase(yyruleno==222);
107668107787
case 225: /* in_op ::= IN */ yytestcase(yyruleno==225);
107788
+#line 153 "parse.y"
107669107789
{yygotominor.yy4 = 0;}
107790
+#line 2204 "parse.c"
107670107791
break;
107671107792
case 29: /* ifnotexists ::= IF NOT EXISTS */
107672107793
case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
107673107794
case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
107674107795
case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
107675107796
case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
107676107797
case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
107677107798
case 223: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==223);
107678107799
case 226: /* in_op ::= NOT IN */ yytestcase(yyruleno==226);
107800
+#line 154 "parse.y"
107679107801
{yygotominor.yy4 = 1;}
107802
+#line 2216 "parse.c"
107680107803
break;
107681107804
case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
107805
+#line 160 "parse.y"
107682107806
{
107683107807
sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
107684107808
}
107809
+#line 2223 "parse.c"
107685107810
break;
107686107811
case 33: /* create_table_args ::= AS select */
107812
+#line 163 "parse.y"
107687107813
{
107688107814
sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy387);
107689107815
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
107690107816
}
107817
+#line 2231 "parse.c"
107691107818
break;
107692107819
case 36: /* column ::= columnid type carglist */
107820
+#line 175 "parse.y"
107693107821
{
107694107822
yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
107695107823
yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n;
107696107824
}
107825
+#line 2239 "parse.c"
107697107826
break;
107698107827
case 37: /* columnid ::= nm */
107828
+#line 179 "parse.y"
107699107829
{
107700107830
sqlite3AddColumn(pParse,&yymsp[0].minor.yy0);
107701107831
yygotominor.yy0 = yymsp[0].minor.yy0;
107702107832
}
107833
+#line 2247 "parse.c"
107703107834
break;
107704107835
case 38: /* id ::= ID */
107705107836
case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39);
107706107837
case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40);
107707107838
case 41: /* nm ::= id */ yytestcase(yyruleno==41);
@@ -107721,256 +107852,373 @@
107721107852
case 264: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==264);
107722107853
case 265: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==265);
107723107854
case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
107724107855
case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
107725107856
case 285: /* trnm ::= nm */ yytestcase(yyruleno==285);
107857
+#line 189 "parse.y"
107726107858
{yygotominor.yy0 = yymsp[0].minor.yy0;}
107859
+#line 2273 "parse.c"
107727107860
break;
107728107861
case 45: /* type ::= typetoken */
107862
+#line 251 "parse.y"
107729107863
{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
107864
+#line 2278 "parse.c"
107730107865
break;
107731107866
case 47: /* typetoken ::= typename LP signed RP */
107867
+#line 253 "parse.y"
107732107868
{
107733107869
yygotominor.yy0.z = yymsp[-3].minor.yy0.z;
107734107870
yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
107735107871
}
107872
+#line 2286 "parse.c"
107736107873
break;
107737107874
case 48: /* typetoken ::= typename LP signed COMMA signed RP */
107875
+#line 257 "parse.y"
107738107876
{
107739107877
yygotominor.yy0.z = yymsp[-5].minor.yy0.z;
107740107878
yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
107741107879
}
107880
+#line 2294 "parse.c"
107742107881
break;
107743107882
case 50: /* typename ::= typename ids */
107883
+#line 263 "parse.y"
107744107884
{yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
107885
+#line 2299 "parse.c"
107745107886
break;
107746107887
case 57: /* ccons ::= DEFAULT term */
107747107888
case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
107889
+#line 274 "parse.y"
107748107890
{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy118);}
107891
+#line 2305 "parse.c"
107749107892
break;
107750107893
case 58: /* ccons ::= DEFAULT LP expr RP */
107894
+#line 275 "parse.y"
107751107895
{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy118);}
107896
+#line 2310 "parse.c"
107752107897
break;
107753107898
case 60: /* ccons ::= DEFAULT MINUS term */
107899
+#line 277 "parse.y"
107754107900
{
107755107901
ExprSpan v;
107756107902
v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy118.pExpr, 0, 0);
107757107903
v.zStart = yymsp[-1].minor.yy0.z;
107758107904
v.zEnd = yymsp[0].minor.yy118.zEnd;
107759107905
sqlite3AddDefaultValue(pParse,&v);
107760107906
}
107907
+#line 2321 "parse.c"
107761107908
break;
107762107909
case 61: /* ccons ::= DEFAULT id */
107910
+#line 284 "parse.y"
107763107911
{
107764107912
ExprSpan v;
107765107913
spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
107766107914
sqlite3AddDefaultValue(pParse,&v);
107767107915
}
107916
+#line 2330 "parse.c"
107768107917
break;
107769107918
case 63: /* ccons ::= NOT NULL onconf */
107919
+#line 294 "parse.y"
107770107920
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
107921
+#line 2335 "parse.c"
107771107922
break;
107772107923
case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
107924
+#line 296 "parse.y"
107773107925
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
107926
+#line 2340 "parse.c"
107774107927
break;
107775107928
case 65: /* ccons ::= UNIQUE onconf */
107929
+#line 297 "parse.y"
107776107930
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0);}
107931
+#line 2345 "parse.c"
107777107932
break;
107778107933
case 66: /* ccons ::= CHECK LP expr RP */
107934
+#line 298 "parse.y"
107779107935
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy118.pExpr);}
107936
+#line 2350 "parse.c"
107780107937
break;
107781107938
case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
107939
+#line 300 "parse.y"
107782107940
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
107941
+#line 2355 "parse.c"
107783107942
break;
107784107943
case 68: /* ccons ::= defer_subclause */
107944
+#line 301 "parse.y"
107785107945
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
107946
+#line 2360 "parse.c"
107786107947
break;
107787107948
case 69: /* ccons ::= COLLATE ids */
107949
+#line 302 "parse.y"
107788107950
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
107951
+#line 2365 "parse.c"
107789107952
break;
107790107953
case 72: /* refargs ::= */
107954
+#line 315 "parse.y"
107791107955
{ yygotominor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
107956
+#line 2370 "parse.c"
107792107957
break;
107793107958
case 73: /* refargs ::= refargs refarg */
107959
+#line 316 "parse.y"
107794107960
{ yygotominor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
107961
+#line 2375 "parse.c"
107795107962
break;
107796107963
case 74: /* refarg ::= MATCH nm */
107797107964
case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
107965
+#line 318 "parse.y"
107798107966
{ yygotominor.yy215.value = 0; yygotominor.yy215.mask = 0x000000; }
107967
+#line 2381 "parse.c"
107799107968
break;
107800107969
case 76: /* refarg ::= ON DELETE refact */
107970
+#line 320 "parse.y"
107801107971
{ yygotominor.yy215.value = yymsp[0].minor.yy4; yygotominor.yy215.mask = 0x0000ff; }
107972
+#line 2386 "parse.c"
107802107973
break;
107803107974
case 77: /* refarg ::= ON UPDATE refact */
107975
+#line 321 "parse.y"
107804107976
{ yygotominor.yy215.value = yymsp[0].minor.yy4<<8; yygotominor.yy215.mask = 0x00ff00; }
107977
+#line 2391 "parse.c"
107805107978
break;
107806107979
case 78: /* refact ::= SET NULL */
107980
+#line 323 "parse.y"
107807107981
{ yygotominor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
107982
+#line 2396 "parse.c"
107808107983
break;
107809107984
case 79: /* refact ::= SET DEFAULT */
107985
+#line 324 "parse.y"
107810107986
{ yygotominor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
107987
+#line 2401 "parse.c"
107811107988
break;
107812107989
case 80: /* refact ::= CASCADE */
107990
+#line 325 "parse.y"
107813107991
{ yygotominor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
107992
+#line 2406 "parse.c"
107814107993
break;
107815107994
case 81: /* refact ::= RESTRICT */
107995
+#line 326 "parse.y"
107816107996
{ yygotominor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
107997
+#line 2411 "parse.c"
107817107998
break;
107818107999
case 82: /* refact ::= NO ACTION */
108000
+#line 327 "parse.y"
107819108001
{ yygotominor.yy4 = OE_None; /* EV: R-33326-45252 */}
108002
+#line 2416 "parse.c"
107820108003
break;
107821108004
case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
107822108005
case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
107823108006
case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
107824108007
case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
108008
+#line 330 "parse.y"
107825108009
{yygotominor.yy4 = yymsp[0].minor.yy4;}
108010
+#line 2424 "parse.c"
107826108011
break;
107827108012
case 88: /* conslist_opt ::= */
108013
+#line 339 "parse.y"
107828108014
{yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
108015
+#line 2429 "parse.c"
107829108016
break;
107830108017
case 89: /* conslist_opt ::= COMMA conslist */
108018
+#line 340 "parse.y"
107831108019
{yygotominor.yy0 = yymsp[-1].minor.yy0;}
108020
+#line 2434 "parse.c"
107832108021
break;
107833108022
case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
108023
+#line 346 "parse.y"
107834108024
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
108025
+#line 2439 "parse.c"
107835108026
break;
107836108027
case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
108028
+#line 348 "parse.y"
107837108029
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0);}
108030
+#line 2444 "parse.c"
107838108031
break;
107839108032
case 96: /* tcons ::= CHECK LP expr RP onconf */
108033
+#line 350 "parse.y"
107840108034
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy118.pExpr);}
108035
+#line 2449 "parse.c"
107841108036
break;
107842108037
case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
108038
+#line 352 "parse.y"
107843108039
{
107844108040
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
107845108041
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
107846108042
}
108043
+#line 2457 "parse.c"
107847108044
break;
107848108045
case 100: /* onconf ::= */
108046
+#line 366 "parse.y"
107849108047
{yygotominor.yy4 = OE_Default;}
108048
+#line 2462 "parse.c"
107850108049
break;
107851108050
case 102: /* orconf ::= */
108051
+#line 368 "parse.y"
107852108052
{yygotominor.yy210 = OE_Default;}
108053
+#line 2467 "parse.c"
107853108054
break;
107854108055
case 103: /* orconf ::= OR resolvetype */
108056
+#line 369 "parse.y"
107855108057
{yygotominor.yy210 = (u8)yymsp[0].minor.yy4;}
108058
+#line 2472 "parse.c"
107856108059
break;
107857108060
case 105: /* resolvetype ::= IGNORE */
108061
+#line 371 "parse.y"
107858108062
{yygotominor.yy4 = OE_Ignore;}
108063
+#line 2477 "parse.c"
107859108064
break;
107860108065
case 106: /* resolvetype ::= REPLACE */
108066
+#line 372 "parse.y"
107861108067
{yygotominor.yy4 = OE_Replace;}
108068
+#line 2482 "parse.c"
107862108069
break;
107863108070
case 107: /* cmd ::= DROP TABLE ifexists fullname */
108071
+#line 376 "parse.y"
107864108072
{
107865108073
sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
107866108074
}
108075
+#line 2489 "parse.c"
107867108076
break;
107868108077
case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
108078
+#line 386 "parse.y"
107869108079
{
107870108080
sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy387, yymsp[-6].minor.yy4, yymsp[-4].minor.yy4);
107871108081
}
108082
+#line 2496 "parse.c"
107872108083
break;
107873108084
case 111: /* cmd ::= DROP VIEW ifexists fullname */
108085
+#line 389 "parse.y"
107874108086
{
107875108087
sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
107876108088
}
108089
+#line 2503 "parse.c"
107877108090
break;
107878108091
case 112: /* cmd ::= select */
108092
+#line 396 "parse.y"
107879108093
{
107880108094
SelectDest dest = {SRT_Output, 0, 0, 0, 0};
107881108095
sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
107882108096
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
107883108097
}
108098
+#line 2512 "parse.c"
107884108099
break;
107885108100
case 113: /* select ::= oneselect */
108101
+#line 407 "parse.y"
107886108102
{yygotominor.yy387 = yymsp[0].minor.yy387;}
108103
+#line 2517 "parse.c"
107887108104
break;
107888108105
case 114: /* select ::= select multiselect_op oneselect */
108106
+#line 409 "parse.y"
107889108107
{
107890108108
if( yymsp[0].minor.yy387 ){
107891108109
yymsp[0].minor.yy387->op = (u8)yymsp[-1].minor.yy4;
107892108110
yymsp[0].minor.yy387->pPrior = yymsp[-2].minor.yy387;
107893108111
}else{
107894108112
sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy387);
107895108113
}
107896108114
yygotominor.yy387 = yymsp[0].minor.yy387;
107897108115
}
108116
+#line 2530 "parse.c"
107898108117
break;
107899108118
case 116: /* multiselect_op ::= UNION ALL */
108119
+#line 420 "parse.y"
107900108120
{yygotominor.yy4 = TK_ALL;}
108121
+#line 2535 "parse.c"
107901108122
break;
107902108123
case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
108124
+#line 424 "parse.y"
107903108125
{
107904108126
yygotominor.yy387 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy259,yymsp[-4].minor.yy314,yymsp[-3].minor.yy322,yymsp[-2].minor.yy314,yymsp[-1].minor.yy322,yymsp[-7].minor.yy4,yymsp[0].minor.yy292.pLimit,yymsp[0].minor.yy292.pOffset);
107905108127
}
108128
+#line 2542 "parse.c"
107906108129
break;
107907108130
case 122: /* sclp ::= selcollist COMMA */
107908108131
case 247: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==247);
108132
+#line 445 "parse.y"
107909108133
{yygotominor.yy322 = yymsp[-1].minor.yy322;}
108134
+#line 2548 "parse.c"
107910108135
break;
107911108136
case 123: /* sclp ::= */
107912108137
case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
107913108138
case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159);
107914108139
case 240: /* exprlist ::= */ yytestcase(yyruleno==240);
107915108140
case 246: /* idxlist_opt ::= */ yytestcase(yyruleno==246);
108141
+#line 446 "parse.y"
107916108142
{yygotominor.yy322 = 0;}
108143
+#line 2557 "parse.c"
107917108144
break;
107918108145
case 124: /* selcollist ::= sclp expr as */
108146
+#line 447 "parse.y"
107919108147
{
107920108148
yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, yymsp[-1].minor.yy118.pExpr);
107921108149
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[0].minor.yy0, 1);
107922108150
sqlite3ExprListSetSpan(pParse,yygotominor.yy322,&yymsp[-1].minor.yy118);
107923108151
}
108152
+#line 2566 "parse.c"
107924108153
break;
107925108154
case 125: /* selcollist ::= sclp STAR */
108155
+#line 452 "parse.y"
107926108156
{
107927108157
Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
107928108158
yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy322, p);
107929108159
}
108160
+#line 2574 "parse.c"
107930108161
break;
107931108162
case 126: /* selcollist ::= sclp nm DOT STAR */
108163
+#line 456 "parse.y"
107932108164
{
107933108165
Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
107934108166
Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
107935108167
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
107936108168
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, pDot);
107937108169
}
108170
+#line 2584 "parse.c"
107938108171
break;
107939108172
case 129: /* as ::= */
108173
+#line 469 "parse.y"
107940108174
{yygotominor.yy0.n = 0;}
108175
+#line 2589 "parse.c"
107941108176
break;
107942108177
case 130: /* from ::= */
108178
+#line 481 "parse.y"
107943108179
{yygotominor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy259));}
108180
+#line 2594 "parse.c"
107944108181
break;
107945108182
case 131: /* from ::= FROM seltablist */
108183
+#line 482 "parse.y"
107946108184
{
107947108185
yygotominor.yy259 = yymsp[0].minor.yy259;
107948108186
sqlite3SrcListShiftJoinType(yygotominor.yy259);
107949108187
}
108188
+#line 2602 "parse.c"
107950108189
break;
107951108190
case 132: /* stl_prefix ::= seltablist joinop */
108191
+#line 490 "parse.y"
107952108192
{
107953108193
yygotominor.yy259 = yymsp[-1].minor.yy259;
107954108194
if( ALWAYS(yygotominor.yy259 && yygotominor.yy259->nSrc>0) ) yygotominor.yy259->a[yygotominor.yy259->nSrc-1].jointype = (u8)yymsp[0].minor.yy4;
107955108195
}
108196
+#line 2610 "parse.c"
107956108197
break;
107957108198
case 133: /* stl_prefix ::= */
108199
+#line 494 "parse.y"
107958108200
{yygotominor.yy259 = 0;}
108201
+#line 2615 "parse.c"
107959108202
break;
107960108203
case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
108204
+#line 495 "parse.y"
107961108205
{
107962108206
yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107963108207
sqlite3SrcListIndexedBy(pParse, yygotominor.yy259, &yymsp[-2].minor.yy0);
107964108208
}
108209
+#line 2623 "parse.c"
107965108210
break;
107966108211
case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
108212
+#line 501 "parse.y"
107967108213
{
107968108214
yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy387,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107969108215
}
108216
+#line 2630 "parse.c"
107970108217
break;
107971108218
case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
108219
+#line 505 "parse.y"
107972108220
{
107973108221
if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
107974108222
yygotominor.yy259 = yymsp[-4].minor.yy259;
107975108223
}else{
107976108224
Select *pSubquery;
@@ -107977,180 +108225,260 @@
107977108225
sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
107978108226
pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,0,0,0);
107979108227
yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107980108228
}
107981108229
}
108230
+#line 2644 "parse.c"
107982108231
break;
107983108232
case 137: /* dbnm ::= */
107984108233
case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
108234
+#line 530 "parse.y"
107985108235
{yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
108236
+#line 2650 "parse.c"
107986108237
break;
107987108238
case 139: /* fullname ::= nm dbnm */
108239
+#line 535 "parse.y"
107988108240
{yygotominor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
108241
+#line 2655 "parse.c"
107989108242
break;
107990108243
case 140: /* joinop ::= COMMA|JOIN */
108244
+#line 539 "parse.y"
107991108245
{ yygotominor.yy4 = JT_INNER; }
108246
+#line 2660 "parse.c"
107992108247
break;
107993108248
case 141: /* joinop ::= JOIN_KW JOIN */
108249
+#line 540 "parse.y"
107994108250
{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
108251
+#line 2665 "parse.c"
107995108252
break;
107996108253
case 142: /* joinop ::= JOIN_KW nm JOIN */
108254
+#line 541 "parse.y"
107997108255
{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
108256
+#line 2670 "parse.c"
107998108257
break;
107999108258
case 143: /* joinop ::= JOIN_KW nm nm JOIN */
108259
+#line 543 "parse.y"
108000108260
{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
108261
+#line 2675 "parse.c"
108001108262
break;
108002108263
case 144: /* on_opt ::= ON expr */
108003108264
case 155: /* sortitem ::= expr */ yytestcase(yyruleno==155);
108004108265
case 162: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==162);
108005108266
case 169: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==169);
108006108267
case 235: /* case_else ::= ELSE expr */ yytestcase(yyruleno==235);
108007108268
case 237: /* case_operand ::= expr */ yytestcase(yyruleno==237);
108269
+#line 547 "parse.y"
108008108270
{yygotominor.yy314 = yymsp[0].minor.yy118.pExpr;}
108271
+#line 2685 "parse.c"
108009108272
break;
108010108273
case 145: /* on_opt ::= */
108011108274
case 161: /* having_opt ::= */ yytestcase(yyruleno==161);
108012108275
case 168: /* where_opt ::= */ yytestcase(yyruleno==168);
108013108276
case 236: /* case_else ::= */ yytestcase(yyruleno==236);
108014108277
case 238: /* case_operand ::= */ yytestcase(yyruleno==238);
108278
+#line 548 "parse.y"
108015108279
{yygotominor.yy314 = 0;}
108280
+#line 2694 "parse.c"
108016108281
break;
108017108282
case 148: /* indexed_opt ::= NOT INDEXED */
108283
+#line 563 "parse.y"
108018108284
{yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
108285
+#line 2699 "parse.c"
108019108286
break;
108020108287
case 149: /* using_opt ::= USING LP inscollist RP */
108021108288
case 181: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==181);
108289
+#line 567 "parse.y"
108022108290
{yygotominor.yy384 = yymsp[-1].minor.yy384;}
108291
+#line 2705 "parse.c"
108023108292
break;
108024108293
case 150: /* using_opt ::= */
108025108294
case 180: /* inscollist_opt ::= */ yytestcase(yyruleno==180);
108295
+#line 568 "parse.y"
108026108296
{yygotominor.yy384 = 0;}
108297
+#line 2711 "parse.c"
108027108298
break;
108028108299
case 152: /* orderby_opt ::= ORDER BY sortlist */
108029108300
case 160: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==160);
108030108301
case 239: /* exprlist ::= nexprlist */ yytestcase(yyruleno==239);
108302
+#line 579 "parse.y"
108031108303
{yygotominor.yy322 = yymsp[0].minor.yy322;}
108304
+#line 2718 "parse.c"
108032108305
break;
108033108306
case 153: /* sortlist ::= sortlist COMMA sortitem sortorder */
108307
+#line 580 "parse.y"
108034108308
{
108035108309
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
108036108310
if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108037108311
}
108312
+#line 2726 "parse.c"
108038108313
break;
108039108314
case 154: /* sortlist ::= sortitem sortorder */
108315
+#line 584 "parse.y"
108040108316
{
108041108317
yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314);
108042108318
if( yygotominor.yy322 && ALWAYS(yygotominor.yy322->a) ) yygotominor.yy322->a[0].sortOrder = (u8)yymsp[0].minor.yy4;
108043108319
}
108320
+#line 2734 "parse.c"
108044108321
break;
108045108322
case 156: /* sortorder ::= ASC */
108046108323
case 158: /* sortorder ::= */ yytestcase(yyruleno==158);
108324
+#line 592 "parse.y"
108047108325
{yygotominor.yy4 = SQLITE_SO_ASC;}
108326
+#line 2740 "parse.c"
108048108327
break;
108049108328
case 157: /* sortorder ::= DESC */
108329
+#line 593 "parse.y"
108050108330
{yygotominor.yy4 = SQLITE_SO_DESC;}
108331
+#line 2745 "parse.c"
108051108332
break;
108052108333
case 163: /* limit_opt ::= */
108334
+#line 619 "parse.y"
108053108335
{yygotominor.yy292.pLimit = 0; yygotominor.yy292.pOffset = 0;}
108336
+#line 2750 "parse.c"
108054108337
break;
108055108338
case 164: /* limit_opt ::= LIMIT expr */
108339
+#line 620 "parse.y"
108056108340
{yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr; yygotominor.yy292.pOffset = 0;}
108341
+#line 2755 "parse.c"
108057108342
break;
108058108343
case 165: /* limit_opt ::= LIMIT expr OFFSET expr */
108344
+#line 622 "parse.y"
108059108345
{yygotominor.yy292.pLimit = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pOffset = yymsp[0].minor.yy118.pExpr;}
108346
+#line 2760 "parse.c"
108060108347
break;
108061108348
case 166: /* limit_opt ::= LIMIT expr COMMA expr */
108349
+#line 624 "parse.y"
108062108350
{yygotominor.yy292.pOffset = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr;}
108351
+#line 2765 "parse.c"
108063108352
break;
108064108353
case 167: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
108354
+#line 637 "parse.y"
108065108355
{
108066108356
sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
108067108357
sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314);
108068108358
}
108359
+#line 2773 "parse.c"
108069108360
break;
108070108361
case 170: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
108362
+#line 660 "parse.y"
108071108363
{
108072108364
sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
108073108365
sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
108074108366
sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy210);
108075108367
}
108368
+#line 2782 "parse.c"
108076108369
break;
108077108370
case 171: /* setlist ::= setlist COMMA nm EQ expr */
108371
+#line 670 "parse.y"
108078108372
{
108079108373
yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy118.pExpr);
108080108374
sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108081108375
}
108376
+#line 2790 "parse.c"
108082108377
break;
108083108378
case 172: /* setlist ::= nm EQ expr */
108379
+#line 674 "parse.y"
108084108380
{
108085108381
yygotominor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy118.pExpr);
108086108382
sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108087108383
}
108384
+#line 2798 "parse.c"
108088108385
break;
108089108386
case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
108387
+#line 683 "parse.y"
108090108388
{sqlite3Insert(pParse, yymsp[-5].minor.yy259, yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy384, yymsp[-7].minor.yy210);}
108389
+#line 2803 "parse.c"
108091108390
break;
108092108391
case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
108392
+#line 685 "parse.y"
108093108393
{sqlite3Insert(pParse, yymsp[-2].minor.yy259, 0, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy210);}
108394
+#line 2808 "parse.c"
108094108395
break;
108095108396
case 175: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
108397
+#line 687 "parse.y"
108096108398
{sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy210);}
108399
+#line 2813 "parse.c"
108097108400
break;
108098108401
case 176: /* insert_cmd ::= INSERT orconf */
108402
+#line 690 "parse.y"
108099108403
{yygotominor.yy210 = yymsp[0].minor.yy210;}
108404
+#line 2818 "parse.c"
108100108405
break;
108101108406
case 177: /* insert_cmd ::= REPLACE */
108407
+#line 691 "parse.y"
108102108408
{yygotominor.yy210 = OE_Replace;}
108409
+#line 2823 "parse.c"
108103108410
break;
108104108411
case 178: /* itemlist ::= itemlist COMMA expr */
108105108412
case 241: /* nexprlist ::= nexprlist COMMA expr */ yytestcase(yyruleno==241);
108413
+#line 698 "parse.y"
108106108414
{yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy118.pExpr);}
108415
+#line 2829 "parse.c"
108107108416
break;
108108108417
case 179: /* itemlist ::= expr */
108109108418
case 242: /* nexprlist ::= expr */ yytestcase(yyruleno==242);
108419
+#line 700 "parse.y"
108110108420
{yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy118.pExpr);}
108421
+#line 2835 "parse.c"
108111108422
break;
108112108423
case 182: /* inscollist ::= inscollist COMMA nm */
108424
+#line 710 "parse.y"
108113108425
{yygotominor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
108426
+#line 2840 "parse.c"
108114108427
break;
108115108428
case 183: /* inscollist ::= nm */
108429
+#line 712 "parse.y"
108116108430
{yygotominor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
108431
+#line 2845 "parse.c"
108117108432
break;
108118108433
case 184: /* expr ::= term */
108434
+#line 743 "parse.y"
108119108435
{yygotominor.yy118 = yymsp[0].minor.yy118;}
108436
+#line 2850 "parse.c"
108120108437
break;
108121108438
case 185: /* expr ::= LP expr RP */
108439
+#line 744 "parse.y"
108122108440
{yygotominor.yy118.pExpr = yymsp[-1].minor.yy118.pExpr; spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
108441
+#line 2855 "parse.c"
108123108442
break;
108124108443
case 186: /* term ::= NULL */
108125108444
case 191: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==191);
108126108445
case 192: /* term ::= STRING */ yytestcase(yyruleno==192);
108446
+#line 745 "parse.y"
108127108447
{spanExpr(&yygotominor.yy118, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
108448
+#line 2862 "parse.c"
108128108449
break;
108129108450
case 187: /* expr ::= id */
108130108451
case 188: /* expr ::= JOIN_KW */ yytestcase(yyruleno==188);
108452
+#line 746 "parse.y"
108131108453
{spanExpr(&yygotominor.yy118, pParse, TK_ID, &yymsp[0].minor.yy0);}
108454
+#line 2868 "parse.c"
108132108455
break;
108133108456
case 189: /* expr ::= nm DOT nm */
108457
+#line 748 "parse.y"
108134108458
{
108135108459
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108136108460
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108137108461
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
108138108462
spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
108139108463
}
108464
+#line 2878 "parse.c"
108140108465
break;
108141108466
case 190: /* expr ::= nm DOT nm DOT nm */
108467
+#line 754 "parse.y"
108142108468
{
108143108469
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
108144108470
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108145108471
Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108146108472
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
108147108473
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
108148108474
spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108149108475
}
108476
+#line 2890 "parse.c"
108150108477
break;
108151108478
case 193: /* expr ::= REGISTER */
108479
+#line 764 "parse.y"
108152108480
{
108153108481
/* When doing a nested parse, one can include terms in an expression
108154108482
** that look like this: #1 #2 ... These terms refer to registers
108155108483
** in the virtual machine. #N is the N-th register. */
108156108484
if( pParse->nested==0 ){
@@ -108160,32 +108488,40 @@
108160108488
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
108161108489
if( yygotominor.yy118.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy118.pExpr->iTable);
108162108490
}
108163108491
spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108164108492
}
108493
+#line 2907 "parse.c"
108165108494
break;
108166108495
case 194: /* expr ::= VARIABLE */
108496
+#line 777 "parse.y"
108167108497
{
108168108498
spanExpr(&yygotominor.yy118, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
108169108499
sqlite3ExprAssignVarNumber(pParse, yygotominor.yy118.pExpr);
108170108500
spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108171108501
}
108502
+#line 2916 "parse.c"
108172108503
break;
108173108504
case 195: /* expr ::= expr COLLATE ids */
108505
+#line 782 "parse.y"
108174108506
{
108175108507
yygotominor.yy118.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy118.pExpr, &yymsp[0].minor.yy0);
108176108508
yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108177108509
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108178108510
}
108511
+#line 2925 "parse.c"
108179108512
break;
108180108513
case 196: /* expr ::= CAST LP expr AS typetoken RP */
108514
+#line 788 "parse.y"
108181108515
{
108182108516
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy118.pExpr, 0, &yymsp[-1].minor.yy0);
108183108517
spanSet(&yygotominor.yy118,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
108184108518
}
108519
+#line 2933 "parse.c"
108185108520
break;
108186108521
case 197: /* expr ::= ID LP distinct exprlist RP */
108522
+#line 793 "parse.y"
108187108523
{
108188108524
if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
108189108525
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
108190108526
}
108191108527
yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
@@ -108192,47 +108528,59 @@
108192108528
spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108193108529
if( yymsp[-2].minor.yy4 && yygotominor.yy118.pExpr ){
108194108530
yygotominor.yy118.pExpr->flags |= EP_Distinct;
108195108531
}
108196108532
}
108533
+#line 2947 "parse.c"
108197108534
break;
108198108535
case 198: /* expr ::= ID LP STAR RP */
108536
+#line 803 "parse.y"
108199108537
{
108200108538
yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
108201108539
spanSet(&yygotominor.yy118,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
108202108540
}
108541
+#line 2955 "parse.c"
108203108542
break;
108204108543
case 199: /* term ::= CTIME_KW */
108544
+#line 807 "parse.y"
108205108545
{
108206108546
/* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
108207108547
** treated as functions that return constants */
108208108548
yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
108209108549
if( yygotominor.yy118.pExpr ){
108210108550
yygotominor.yy118.pExpr->op = TK_CONST_FUNC;
108211108551
}
108212108552
spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108213108553
}
108554
+#line 2968 "parse.c"
108214108555
break;
108215108556
case 200: /* expr ::= expr AND expr */
108216108557
case 201: /* expr ::= expr OR expr */ yytestcase(yyruleno==201);
108217108558
case 202: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==202);
108218108559
case 203: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==203);
108219108560
case 204: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==204);
108220108561
case 205: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==205);
108221108562
case 206: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==206);
108222108563
case 207: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==207);
108564
+#line 834 "parse.y"
108223108565
{spanBinaryExpr(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);}
108566
+#line 2980 "parse.c"
108224108567
break;
108225108568
case 208: /* likeop ::= LIKE_KW */
108226108569
case 210: /* likeop ::= MATCH */ yytestcase(yyruleno==210);
108570
+#line 847 "parse.y"
108227108571
{yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 0;}
108572
+#line 2986 "parse.c"
108228108573
break;
108229108574
case 209: /* likeop ::= NOT LIKE_KW */
108230108575
case 211: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==211);
108576
+#line 848 "parse.y"
108231108577
{yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 1;}
108578
+#line 2992 "parse.c"
108232108579
break;
108233108580
case 212: /* expr ::= expr likeop expr */
108581
+#line 851 "parse.y"
108234108582
{
108235108583
ExprList *pList;
108236108584
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy118.pExpr);
108237108585
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy118.pExpr);
108238108586
yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy342.eOperator);
@@ -108239,12 +108587,14 @@
108239108587
if( yymsp[-1].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108240108588
yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108241108589
yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108242108590
if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108243108591
}
108592
+#line 3006 "parse.c"
108244108593
break;
108245108594
case 213: /* expr ::= expr likeop expr ESCAPE expr */
108595
+#line 861 "parse.y"
108246108596
{
108247108597
ExprList *pList;
108248108598
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108249108599
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy118.pExpr);
108250108600
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
@@ -108252,40 +108602,56 @@
108252108602
if( yymsp[-3].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108253108603
yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108254108604
yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108255108605
if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108256108606
}
108607
+#line 3021 "parse.c"
108257108608
break;
108258108609
case 214: /* expr ::= expr ISNULL|NOTNULL */
108610
+#line 889 "parse.y"
108259108611
{spanUnaryPostfix(&yygotominor.yy118,pParse,yymsp[0].major,&yymsp[-1].minor.yy118,&yymsp[0].minor.yy0);}
108612
+#line 3026 "parse.c"
108260108613
break;
108261108614
case 215: /* expr ::= expr NOT NULL */
108615
+#line 890 "parse.y"
108262108616
{spanUnaryPostfix(&yygotominor.yy118,pParse,TK_NOTNULL,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy0);}
108617
+#line 3031 "parse.c"
108263108618
break;
108264108619
case 216: /* expr ::= expr IS expr */
108620
+#line 911 "parse.y"
108265108621
{
108266108622
spanBinaryExpr(&yygotominor.yy118,pParse,TK_IS,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);
108267108623
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_ISNULL);
108268108624
}
108625
+#line 3039 "parse.c"
108269108626
break;
108270108627
case 217: /* expr ::= expr IS NOT expr */
108628
+#line 915 "parse.y"
108271108629
{
108272108630
spanBinaryExpr(&yygotominor.yy118,pParse,TK_ISNOT,&yymsp[-3].minor.yy118,&yymsp[0].minor.yy118);
108273108631
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_NOTNULL);
108274108632
}
108633
+#line 3047 "parse.c"
108275108634
break;
108276108635
case 218: /* expr ::= NOT expr */
108277108636
case 219: /* expr ::= BITNOT expr */ yytestcase(yyruleno==219);
108637
+#line 938 "parse.y"
108278108638
{spanUnaryPrefix(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108639
+#line 3053 "parse.c"
108279108640
break;
108280108641
case 220: /* expr ::= MINUS expr */
108642
+#line 941 "parse.y"
108281108643
{spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UMINUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108644
+#line 3058 "parse.c"
108282108645
break;
108283108646
case 221: /* expr ::= PLUS expr */
108647
+#line 943 "parse.y"
108284108648
{spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UPLUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108649
+#line 3063 "parse.c"
108285108650
break;
108286108651
case 224: /* expr ::= expr between_op expr AND expr */
108652
+#line 948 "parse.y"
108287108653
{
108288108654
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108289108655
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
108290108656
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108291108657
if( yygotominor.yy118.pExpr ){
@@ -108295,12 +108661,14 @@
108295108661
}
108296108662
if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108297108663
yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108298108664
yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108299108665
}
108666
+#line 3080 "parse.c"
108300108667
break;
108301108668
case 227: /* expr ::= expr in_op LP exprlist RP */
108669
+#line 965 "parse.y"
108302108670
{
108303108671
if( yymsp[-1].minor.yy322==0 ){
108304108672
/* Expressions of the form
108305108673
**
108306108674
** expr1 IN ()
@@ -108322,12 +108690,14 @@
108322108690
if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108323108691
}
108324108692
yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108325108693
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108326108694
}
108695
+#line 3109 "parse.c"
108327108696
break;
108328108697
case 228: /* expr ::= LP select RP */
108698
+#line 990 "parse.y"
108329108699
{
108330108700
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
108331108701
if( yygotominor.yy118.pExpr ){
108332108702
yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108333108703
ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108336,12 +108706,14 @@
108336108706
sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108337108707
}
108338108708
yygotominor.yy118.zStart = yymsp[-2].minor.yy0.z;
108339108709
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108340108710
}
108711
+#line 3125 "parse.c"
108341108712
break;
108342108713
case 229: /* expr ::= expr in_op LP select RP */
108714
+#line 1002 "parse.y"
108343108715
{
108344108716
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108345108717
if( yygotominor.yy118.pExpr ){
108346108718
yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108347108719
ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108351,12 +108723,14 @@
108351108723
}
108352108724
if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108353108725
yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108354108726
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108355108727
}
108728
+#line 3142 "parse.c"
108356108729
break;
108357108730
case 230: /* expr ::= expr in_op nm dbnm */
108731
+#line 1015 "parse.y"
108358108732
{
108359108733
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
108360108734
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy118.pExpr, 0, 0);
108361108735
if( yygotominor.yy118.pExpr ){
108362108736
yygotominor.yy118.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
@@ -108367,12 +108741,14 @@
108367108741
}
108368108742
if( yymsp[-2].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108369108743
yygotominor.yy118.zStart = yymsp[-3].minor.yy118.zStart;
108370108744
yygotominor.yy118.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
108371108745
}
108746
+#line 3160 "parse.c"
108372108747
break;
108373108748
case 231: /* expr ::= EXISTS LP select RP */
108749
+#line 1029 "parse.y"
108374108750
{
108375108751
Expr *p = yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
108376108752
if( p ){
108377108753
p->x.pSelect = yymsp[-1].minor.yy387;
108378108754
ExprSetProperty(p, EP_xIsSelect);
@@ -108381,12 +108757,14 @@
108381108757
sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108382108758
}
108383108759
yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
108384108760
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108385108761
}
108762
+#line 3176 "parse.c"
108386108763
break;
108387108764
case 232: /* expr ::= CASE case_operand case_exprlist case_else END */
108765
+#line 1044 "parse.y"
108388108766
{
108389108767
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, 0);
108390108768
if( yygotominor.yy118.pExpr ){
108391108769
yygotominor.yy118.pExpr->x.pList = yymsp[-2].minor.yy322;
108392108770
sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
@@ -108394,38 +108772,50 @@
108394108772
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
108395108773
}
108396108774
yygotominor.yy118.zStart = yymsp[-4].minor.yy0.z;
108397108775
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108398108776
}
108777
+#line 3191 "parse.c"
108399108778
break;
108400108779
case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
108780
+#line 1057 "parse.y"
108401108781
{
108402108782
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy118.pExpr);
108403108783
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108404108784
}
108785
+#line 3199 "parse.c"
108405108786
break;
108406108787
case 234: /* case_exprlist ::= WHEN expr THEN expr */
108788
+#line 1061 "parse.y"
108407108789
{
108408108790
yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108409108791
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108410108792
}
108793
+#line 3207 "parse.c"
108411108794
break;
108412108795
case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
108796
+#line 1090 "parse.y"
108413108797
{
108414108798
sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
108415108799
sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy322, yymsp[-9].minor.yy4,
108416108800
&yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy4);
108417108801
}
108802
+#line 3216 "parse.c"
108418108803
break;
108419108804
case 244: /* uniqueflag ::= UNIQUE */
108420108805
case 298: /* raisetype ::= ABORT */ yytestcase(yyruleno==298);
108806
+#line 1097 "parse.y"
108421108807
{yygotominor.yy4 = OE_Abort;}
108808
+#line 3222 "parse.c"
108422108809
break;
108423108810
case 245: /* uniqueflag ::= */
108811
+#line 1098 "parse.y"
108424108812
{yygotominor.yy4 = OE_None;}
108813
+#line 3227 "parse.c"
108425108814
break;
108426108815
case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */
108816
+#line 1107 "parse.y"
108427108817
{
108428108818
Expr *p = 0;
108429108819
if( yymsp[-1].minor.yy0.n>0 ){
108430108820
p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
108431108821
sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108433,12 +108823,14 @@
108433108823
yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, p);
108434108824
sqlite3ExprListSetName(pParse,yygotominor.yy322,&yymsp[-2].minor.yy0,1);
108435108825
sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108436108826
if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108437108827
}
108828
+#line 3242 "parse.c"
108438108829
break;
108439108830
case 249: /* idxlist ::= nm collate sortorder */
108831
+#line 1118 "parse.y"
108440108832
{
108441108833
Expr *p = 0;
108442108834
if( yymsp[-1].minor.yy0.n>0 ){
108443108835
p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
108444108836
sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108446,214 +108838,307 @@
108446108838
yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, p);
108447108839
sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108448108840
sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108449108841
if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108450108842
}
108843
+#line 3257 "parse.c"
108451108844
break;
108452108845
case 250: /* collate ::= */
108846
+#line 1131 "parse.y"
108453108847
{yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
108848
+#line 3262 "parse.c"
108454108849
break;
108455108850
case 252: /* cmd ::= DROP INDEX ifexists fullname */
108851
+#line 1137 "parse.y"
108456108852
{sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
108853
+#line 3267 "parse.c"
108457108854
break;
108458108855
case 253: /* cmd ::= VACUUM */
108459108856
case 254: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==254);
108857
+#line 1143 "parse.y"
108460108858
{sqlite3Vacuum(pParse);}
108859
+#line 3273 "parse.c"
108461108860
break;
108462108861
case 255: /* cmd ::= PRAGMA nm dbnm */
108862
+#line 1151 "parse.y"
108463108863
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
108864
+#line 3278 "parse.c"
108464108865
break;
108465108866
case 256: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
108867
+#line 1152 "parse.y"
108466108868
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
108869
+#line 3283 "parse.c"
108467108870
break;
108468108871
case 257: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
108872
+#line 1153 "parse.y"
108469108873
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
108874
+#line 3288 "parse.c"
108470108875
break;
108471108876
case 258: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
108877
+#line 1155 "parse.y"
108472108878
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
108879
+#line 3293 "parse.c"
108473108880
break;
108474108881
case 259: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
108882
+#line 1157 "parse.y"
108475108883
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
108884
+#line 3298 "parse.c"
108476108885
break;
108477108886
case 270: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
108887
+#line 1175 "parse.y"
108478108888
{
108479108889
Token all;
108480108890
all.z = yymsp[-3].minor.yy0.z;
108481108891
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
108482108892
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
108483108893
}
108894
+#line 3308 "parse.c"
108484108895
break;
108485108896
case 271: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
108897
+#line 1184 "parse.y"
108486108898
{
108487108899
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy4, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy259, yymsp[0].minor.yy314, yymsp[-10].minor.yy4, yymsp[-8].minor.yy4);
108488108900
yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
108489108901
}
108902
+#line 3316 "parse.c"
108490108903
break;
108491108904
case 272: /* trigger_time ::= BEFORE */
108492108905
case 275: /* trigger_time ::= */ yytestcase(yyruleno==275);
108906
+#line 1190 "parse.y"
108493108907
{ yygotominor.yy4 = TK_BEFORE; }
108908
+#line 3322 "parse.c"
108494108909
break;
108495108910
case 273: /* trigger_time ::= AFTER */
108911
+#line 1191 "parse.y"
108496108912
{ yygotominor.yy4 = TK_AFTER; }
108913
+#line 3327 "parse.c"
108497108914
break;
108498108915
case 274: /* trigger_time ::= INSTEAD OF */
108916
+#line 1192 "parse.y"
108499108917
{ yygotominor.yy4 = TK_INSTEAD;}
108918
+#line 3332 "parse.c"
108500108919
break;
108501108920
case 276: /* trigger_event ::= DELETE|INSERT */
108502108921
case 277: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==277);
108922
+#line 1197 "parse.y"
108503108923
{yygotominor.yy90.a = yymsp[0].major; yygotominor.yy90.b = 0;}
108924
+#line 3338 "parse.c"
108504108925
break;
108505108926
case 278: /* trigger_event ::= UPDATE OF inscollist */
108927
+#line 1199 "parse.y"
108506108928
{yygotominor.yy90.a = TK_UPDATE; yygotominor.yy90.b = yymsp[0].minor.yy384;}
108929
+#line 3343 "parse.c"
108507108930
break;
108508108931
case 281: /* when_clause ::= */
108509108932
case 303: /* key_opt ::= */ yytestcase(yyruleno==303);
108933
+#line 1206 "parse.y"
108510108934
{ yygotominor.yy314 = 0; }
108935
+#line 3349 "parse.c"
108511108936
break;
108512108937
case 282: /* when_clause ::= WHEN expr */
108513108938
case 304: /* key_opt ::= KEY expr */ yytestcase(yyruleno==304);
108939
+#line 1207 "parse.y"
108514108940
{ yygotominor.yy314 = yymsp[0].minor.yy118.pExpr; }
108941
+#line 3355 "parse.c"
108515108942
break;
108516108943
case 283: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
108944
+#line 1211 "parse.y"
108517108945
{
108518108946
assert( yymsp[-2].minor.yy203!=0 );
108519108947
yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
108520108948
yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
108521108949
yygotominor.yy203 = yymsp[-2].minor.yy203;
108522108950
}
108951
+#line 3365 "parse.c"
108523108952
break;
108524108953
case 284: /* trigger_cmd_list ::= trigger_cmd SEMI */
108954
+#line 1217 "parse.y"
108525108955
{
108526108956
assert( yymsp[-1].minor.yy203!=0 );
108527108957
yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
108528108958
yygotominor.yy203 = yymsp[-1].minor.yy203;
108529108959
}
108960
+#line 3374 "parse.c"
108530108961
break;
108531108962
case 286: /* trnm ::= nm DOT nm */
108963
+#line 1229 "parse.y"
108532108964
{
108533108965
yygotominor.yy0 = yymsp[0].minor.yy0;
108534108966
sqlite3ErrorMsg(pParse,
108535108967
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
108536108968
"statements within triggers");
108537108969
}
108970
+#line 3384 "parse.c"
108538108971
break;
108539108972
case 288: /* tridxby ::= INDEXED BY nm */
108973
+#line 1241 "parse.y"
108540108974
{
108541108975
sqlite3ErrorMsg(pParse,
108542108976
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
108543108977
"within triggers");
108544108978
}
108979
+#line 3393 "parse.c"
108545108980
break;
108546108981
case 289: /* tridxby ::= NOT INDEXED */
108982
+#line 1246 "parse.y"
108547108983
{
108548108984
sqlite3ErrorMsg(pParse,
108549108985
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
108550108986
"within triggers");
108551108987
}
108988
+#line 3402 "parse.c"
108552108989
break;
108553108990
case 290: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
108991
+#line 1259 "parse.y"
108554108992
{ yygotominor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy314, yymsp[-5].minor.yy210); }
108993
+#line 3407 "parse.c"
108555108994
break;
108556108995
case 291: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP */
108996
+#line 1264 "parse.y"
108557108997
{yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy384, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy210);}
108998
+#line 3412 "parse.c"
108558108999
break;
108559109000
case 292: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
109001
+#line 1267 "parse.y"
108560109002
{yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy384, 0, yymsp[0].minor.yy387, yymsp[-4].minor.yy210);}
109003
+#line 3417 "parse.c"
108561109004
break;
108562109005
case 293: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
109006
+#line 1271 "parse.y"
108563109007
{yygotominor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy314);}
109008
+#line 3422 "parse.c"
108564109009
break;
108565109010
case 294: /* trigger_cmd ::= select */
109011
+#line 1274 "parse.y"
108566109012
{yygotominor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy387); }
109013
+#line 3427 "parse.c"
108567109014
break;
108568109015
case 295: /* expr ::= RAISE LP IGNORE RP */
109016
+#line 1277 "parse.y"
108569109017
{
108570109018
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
108571109019
if( yygotominor.yy118.pExpr ){
108572109020
yygotominor.yy118.pExpr->affinity = OE_Ignore;
108573109021
}
108574109022
yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
108575109023
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108576109024
}
109025
+#line 3439 "parse.c"
108577109026
break;
108578109027
case 296: /* expr ::= RAISE LP raisetype COMMA nm RP */
109028
+#line 1285 "parse.y"
108579109029
{
108580109030
yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
108581109031
if( yygotominor.yy118.pExpr ) {
108582109032
yygotominor.yy118.pExpr->affinity = (char)yymsp[-3].minor.yy4;
108583109033
}
108584109034
yygotominor.yy118.zStart = yymsp[-5].minor.yy0.z;
108585109035
yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108586109036
}
109037
+#line 3451 "parse.c"
108587109038
break;
108588109039
case 297: /* raisetype ::= ROLLBACK */
109040
+#line 1296 "parse.y"
108589109041
{yygotominor.yy4 = OE_Rollback;}
109042
+#line 3456 "parse.c"
108590109043
break;
108591109044
case 299: /* raisetype ::= FAIL */
109045
+#line 1298 "parse.y"
108592109046
{yygotominor.yy4 = OE_Fail;}
109047
+#line 3461 "parse.c"
108593109048
break;
108594109049
case 300: /* cmd ::= DROP TRIGGER ifexists fullname */
109050
+#line 1303 "parse.y"
108595109051
{
108596109052
sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
108597109053
}
109054
+#line 3468 "parse.c"
108598109055
break;
108599109056
case 301: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
109057
+#line 1310 "parse.y"
108600109058
{
108601109059
sqlite3Attach(pParse, yymsp[-3].minor.yy118.pExpr, yymsp[-1].minor.yy118.pExpr, yymsp[0].minor.yy314);
108602109060
}
109061
+#line 3475 "parse.c"
108603109062
break;
108604109063
case 302: /* cmd ::= DETACH database_kw_opt expr */
109064
+#line 1313 "parse.y"
108605109065
{
108606109066
sqlite3Detach(pParse, yymsp[0].minor.yy118.pExpr);
108607109067
}
109068
+#line 3482 "parse.c"
108608109069
break;
108609109070
case 307: /* cmd ::= REINDEX */
109071
+#line 1328 "parse.y"
108610109072
{sqlite3Reindex(pParse, 0, 0);}
109073
+#line 3487 "parse.c"
108611109074
break;
108612109075
case 308: /* cmd ::= REINDEX nm dbnm */
109076
+#line 1329 "parse.y"
108613109077
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
109078
+#line 3492 "parse.c"
108614109079
break;
108615109080
case 309: /* cmd ::= ANALYZE */
109081
+#line 1334 "parse.y"
108616109082
{sqlite3Analyze(pParse, 0, 0);}
109083
+#line 3497 "parse.c"
108617109084
break;
108618109085
case 310: /* cmd ::= ANALYZE nm dbnm */
109086
+#line 1335 "parse.y"
108619109087
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
109088
+#line 3502 "parse.c"
108620109089
break;
108621109090
case 311: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
109091
+#line 1340 "parse.y"
108622109092
{
108623109093
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
108624109094
}
109095
+#line 3509 "parse.c"
108625109096
break;
108626109097
case 312: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
109098
+#line 1343 "parse.y"
108627109099
{
108628109100
sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
108629109101
}
109102
+#line 3516 "parse.c"
108630109103
break;
108631109104
case 313: /* add_column_fullname ::= fullname */
109105
+#line 1346 "parse.y"
108632109106
{
108633109107
pParse->db->lookaside.bEnabled = 0;
108634109108
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
108635109109
}
109110
+#line 3524 "parse.c"
108636109111
break;
108637109112
case 316: /* cmd ::= create_vtab */
109113
+#line 1356 "parse.y"
108638109114
{sqlite3VtabFinishParse(pParse,0);}
109115
+#line 3529 "parse.c"
108639109116
break;
108640109117
case 317: /* cmd ::= create_vtab LP vtabarglist RP */
109118
+#line 1357 "parse.y"
108641109119
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
109120
+#line 3534 "parse.c"
108642109121
break;
108643109122
case 318: /* create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm */
109123
+#line 1358 "parse.y"
108644109124
{
108645109125
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
108646109126
}
109127
+#line 3541 "parse.c"
108647109128
break;
108648109129
case 321: /* vtabarg ::= */
109130
+#line 1363 "parse.y"
108649109131
{sqlite3VtabArgInit(pParse);}
109132
+#line 3546 "parse.c"
108650109133
break;
108651109134
case 323: /* vtabargtoken ::= ANY */
108652109135
case 324: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==324);
108653109136
case 325: /* lp ::= LP */ yytestcase(yyruleno==325);
109137
+#line 1365 "parse.y"
108654109138
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
109139
+#line 3553 "parse.c"
108655109140
break;
108656109141
default:
108657109142
/* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
108658109143
/* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
108659109144
/* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2);
@@ -108751,15 +109236,17 @@
108751109236
int yymajor, /* The major type of the error token */
108752109237
YYMINORTYPE yyminor /* The minor type of the error token */
108753109238
){
108754109239
sqlite3ParserARG_FETCH;
108755109240
#define TOKEN (yyminor.yy0)
109241
+#line 32 "parse.y"
108756109242
108757109243
UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
108758109244
assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
108759109245
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
108760109246
pParse->parseError = 1;
109247
+#line 3661 "parse.c"
108761109248
sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
108762109249
}
108763109250
108764109251
/*
108765109252
** The following is executed when the parser accepts
@@ -108949,10 +109436,11 @@
108949109436
return;
108950109437
}
108951109438
108952109439
/************** End of parse.c ***********************************************/
108953109440
/************** Begin file tokenize.c ****************************************/
109441
+#line 1 "tsrc/tokenize.c"
108954109442
/*
108955109443
** 2001 September 15
108956109444
**
108957109445
** The author disclaims copyright to this source code. In place of
108958109446
** a legal notice, here is a blessing:
@@ -109014,10 +109502,11 @@
109014109502
** named keywordhash.h and then included into this source file by
109015109503
** the #include below.
109016109504
*/
109017109505
/************** Include keywordhash.h in the middle of tokenize.c ************/
109018109506
/************** Begin file keywordhash.h *************************************/
109507
+#line 1 "tsrc/keywordhash.h"
109019109508
/***** This file contains automatically generated code ******
109020109509
**
109021109510
** The code in this file has been automatically generated by
109022109511
**
109023109512
** sqlite/tool/mkkeywordhash.c
@@ -109287,10 +109776,11 @@
109287109776
}
109288109777
#define SQLITE_N_KEYWORD 121
109289109778
109290109779
/************** End of keywordhash.h *****************************************/
109291109780
/************** Continuing where we left off in tokenize.c *******************/
109781
+#line 66 "tsrc/tokenize.c"
109292109782
109293109783
109294109784
/*
109295109785
** If X is a character that can be used in an identifier then
109296109786
** IdChar(X) will be true. Otherwise it is false.
@@ -109751,10 +110241,11 @@
109751110241
return nErr;
109752110242
}
109753110243
109754110244
/************** End of tokenize.c ********************************************/
109755110245
/************** Begin file complete.c ****************************************/
110246
+#line 1 "tsrc/complete.c"
109756110247
/*
109757110248
** 2001 September 15
109758110249
**
109759110250
** The author disclaims copyright to this source code. In place of
109760110251
** a legal notice, here is a blessing:
@@ -110036,10 +110527,11 @@
110036110527
#endif /* SQLITE_OMIT_UTF16 */
110037110528
#endif /* SQLITE_OMIT_COMPLETE */
110038110529
110039110530
/************** End of complete.c ********************************************/
110040110531
/************** Begin file main.c ********************************************/
110532
+#line 1 "tsrc/main.c"
110041110533
/*
110042110534
** 2001 September 15
110043110535
**
110044110536
** The author disclaims copyright to this source code. In place of
110045110537
** a legal notice, here is a blessing:
@@ -110056,10 +110548,11 @@
110056110548
*/
110057110549
110058110550
#ifdef SQLITE_ENABLE_FTS3
110059110551
/************** Include fts3.h in the middle of main.c ***********************/
110060110552
/************** Begin file fts3.h ********************************************/
110553
+#line 1 "tsrc/fts3.h"
110061110554
/*
110062110555
** 2006 Oct 10
110063110556
**
110064110557
** The author disclaims copyright to this source code. In place of
110065110558
** a legal notice, here is a blessing:
@@ -110084,14 +110577,16 @@
110084110577
} /* extern "C" */
110085110578
#endif /* __cplusplus */
110086110579
110087110580
/************** End of fts3.h ************************************************/
110088110581
/************** Continuing where we left off in main.c ***********************/
110582
+#line 21 "tsrc/main.c"
110089110583
#endif
110090110584
#ifdef SQLITE_ENABLE_RTREE
110091110585
/************** Include rtree.h in the middle of main.c **********************/
110092110586
/************** Begin file rtree.h *******************************************/
110587
+#line 1 "tsrc/rtree.h"
110093110588
/*
110094110589
** 2008 May 26
110095110590
**
110096110591
** The author disclaims copyright to this source code. In place of
110097110592
** a legal notice, here is a blessing:
@@ -110116,14 +110611,16 @@
110116110611
} /* extern "C" */
110117110612
#endif /* __cplusplus */
110118110613
110119110614
/************** End of rtree.h ***********************************************/
110120110615
/************** Continuing where we left off in main.c ***********************/
110616
+#line 24 "tsrc/main.c"
110121110617
#endif
110122110618
#ifdef SQLITE_ENABLE_ICU
110123110619
/************** Include sqliteicu.h in the middle of main.c ******************/
110124110620
/************** Begin file sqliteicu.h ***************************************/
110621
+#line 1 "tsrc/sqliteicu.h"
110125110622
/*
110126110623
** 2008 May 26
110127110624
**
110128110625
** The author disclaims copyright to this source code. In place of
110129110626
** a legal notice, here is a blessing:
@@ -110149,10 +110646,11 @@
110149110646
#endif /* __cplusplus */
110150110647
110151110648
110152110649
/************** End of sqliteicu.h *******************************************/
110153110650
/************** Continuing where we left off in main.c ***********************/
110651
+#line 27 "tsrc/main.c"
110154110652
#endif
110155110653
110156110654
#ifndef SQLITE_AMALGAMATION
110157110655
/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
110158110656
** contains the text of SQLITE_VERSION macro.
@@ -113079,10 +113577,11 @@
113079113577
return 0;
113080113578
}
113081113579
113082113580
/************** End of main.c ************************************************/
113083113581
/************** Begin file notify.c ******************************************/
113582
+#line 1 "tsrc/notify.c"
113084113583
/*
113085113584
** 2009 March 3
113086113585
**
113087113586
** The author disclaims copyright to this source code. In place of
113088113587
** a legal notice, here is a blessing:
@@ -113412,10 +113911,11 @@
113412113911
}
113413113912
#endif
113414113913
113415113914
/************** End of notify.c **********************************************/
113416113915
/************** Begin file fts3.c ********************************************/
113916
+#line 1 "tsrc/fts3.c"
113417113917
/*
113418113918
** 2006 Oct 10
113419113919
**
113420113920
** The author disclaims copyright to this source code. In place of
113421113921
** a legal notice, here is a blessing:
@@ -113708,10 +114208,11 @@
113708114208
** into a single segment.
113709114209
*/
113710114210
113711114211
/************** Include fts3Int.h in the middle of fts3.c ********************/
113712114212
/************** Begin file fts3Int.h *****************************************/
114213
+#line 1 "tsrc/fts3Int.h"
113713114214
/*
113714114215
** 2009 Nov 12
113715114216
**
113716114217
** The author disclaims copyright to this source code. In place of
113717114218
** a legal notice, here is a blessing:
@@ -113746,10 +114247,11 @@
113746114247
SQLITE_API extern const sqlite3_api_routines *sqlite3_api;
113747114248
#endif
113748114249
113749114250
/************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
113750114251
/************** Begin file fts3_tokenizer.h **********************************/
114252
+#line 1 "tsrc/fts3_tokenizer.h"
113751114253
/*
113752114254
** 2006 July 10
113753114255
**
113754114256
** The author disclaims copyright to this source code.
113755114257
**
@@ -113900,12 +114402,14 @@
113900114402
113901114403
#endif /* _FTS3_TOKENIZER_H_ */
113902114404
113903114405
/************** End of fts3_tokenizer.h **************************************/
113904114406
/************** Continuing where we left off in fts3Int.h ********************/
114407
+#line 40 "tsrc/fts3Int.h"
113905114408
/************** Include fts3_hash.h in the middle of fts3Int.h ***************/
113906114409
/************** Begin file fts3_hash.h ***************************************/
114410
+#line 1 "tsrc/fts3_hash.h"
113907114411
/*
113908114412
** 2001 September 22
113909114413
**
113910114414
** The author disclaims copyright to this source code. In place of
113911114415
** a legal notice, here is a blessing:
@@ -114017,10 +114521,11 @@
114017114521
114018114522
#endif /* _FTS3_HASH_H_ */
114019114523
114020114524
/************** End of fts3_hash.h *******************************************/
114021114525
/************** Continuing where we left off in fts3Int.h ********************/
114526
+#line 41 "tsrc/fts3Int.h"
114022114527
114023114528
/*
114024114529
** This constant controls how often segments are merged. Once there are
114025114530
** FTS3_MERGE_COUNT segments of level N, they are merged into a single
114026114531
** segment of level N+1.
@@ -114493,10 +114998,11 @@
114493114998
#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
114494114999
#endif /* _FTSINT_H */
114495115000
114496115001
/************** End of fts3Int.h *********************************************/
114497115002
/************** Continuing where we left off in fts3.c ***********************/
115003
+#line 296 "tsrc/fts3.c"
114498115004
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
114499115005
114500115006
#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
114501115007
# define SQLITE_CORE 1
114502115008
#endif
@@ -116264,11 +116770,41 @@
116264116770
char *aOut;
116265116771
int bFirstOut = 0;
116266116772
116267116773
*paOut = 0;
116268116774
*pnOut = 0;
116269
- aOut = sqlite3_malloc(n1+n2);
116775
+
116776
+ /* Allocate space for the output. Both the input and output doclists
116777
+ ** are delta encoded. If they are in ascending order (bDescDoclist==0),
116778
+ ** then the first docid in each list is simply encoded as a varint. For
116779
+ ** each subsequent docid, the varint stored is the difference between the
116780
+ ** current and previous docid (a positive number - since the list is in
116781
+ ** ascending order).
116782
+ **
116783
+ ** The first docid written to the output is therefore encoded using the
116784
+ ** same number of bytes as it is in whichever of the input lists it is
116785
+ ** read from. And each subsequent docid read from the same input list
116786
+ ** consumes either the same or less bytes as it did in the input (since
116787
+ ** the difference between it and the previous value in the output must
116788
+ ** be a positive value less than or equal to the delta value read from
116789
+ ** the input list). The same argument applies to all but the first docid
116790
+ ** read from the 'other' list. And to the contents of all position lists
116791
+ ** that will be copied and merged from the input to the output.
116792
+ **
116793
+ ** However, if the first docid copied to the output is a negative number,
116794
+ ** then the encoding of the first docid from the 'other' input list may
116795
+ ** be larger in the output than it was in the input (since the delta value
116796
+ ** may be a larger positive integer than the actual docid).
116797
+ **
116798
+ ** The space required to store the output is therefore the sum of the
116799
+ ** sizes of the two inputs, plus enough space for exactly one of the input
116800
+ ** docids to grow.
116801
+ **
116802
+ ** A symetric argument may be made if the doclists are in descending
116803
+ ** order.
116804
+ */
116805
+ aOut = sqlite3_malloc(n1+n2+FTS3_VARINT_MAX-1);
116270116806
if( !aOut ) return SQLITE_NOMEM;
116271116807
116272116808
p = aOut;
116273116809
fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);
116274116810
fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);
@@ -116291,10 +116827,11 @@
116291116827
}
116292116828
}
116293116829
116294116830
*paOut = aOut;
116295116831
*pnOut = (p-aOut);
116832
+ assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 );
116296116833
return SQLITE_OK;
116297116834
}
116298116835
116299116836
/*
116300116837
** This function does a "phrase" merge of two doclists. In a phrase merge,
@@ -119011,10 +119548,11 @@
119011119548
119012119549
#endif
119013119550
119014119551
/************** End of fts3.c ************************************************/
119015119552
/************** Begin file fts3_aux.c ****************************************/
119553
+#line 1 "tsrc/fts3_aux.c"
119016119554
/*
119017119555
** 2011 Jan 27
119018119556
**
119019119557
** The author disclaims copyright to this source code. In place of
119020119558
** a legal notice, here is a blessing:
@@ -119487,10 +120025,11 @@
119487120025
119488120026
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
119489120027
119490120028
/************** End of fts3_aux.c ********************************************/
119491120029
/************** Begin file fts3_expr.c ***************************************/
120030
+#line 1 "tsrc/fts3_expr.c"
119492120031
/*
119493120032
** 2008 Nov 28
119494120033
**
119495120034
** The author disclaims copyright to this source code. In place of
119496120035
** a legal notice, here is a blessing:
@@ -120453,10 +120992,11 @@
120453120992
#endif
120454120993
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120455120994
120456120995
/************** End of fts3_expr.c *******************************************/
120457120996
/************** Begin file fts3_hash.c ***************************************/
120997
+#line 1 "tsrc/fts3_hash.c"
120458120998
/*
120459120999
** 2001 September 22
120460121000
**
120461121001
** The author disclaims copyright to this source code. In place of
120462121002
** a legal notice, here is a blessing:
@@ -120837,10 +121377,11 @@
120837121377
120838121378
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120839121379
120840121380
/************** End of fts3_hash.c *******************************************/
120841121381
/************** Begin file fts3_porter.c *************************************/
121382
+#line 1 "tsrc/fts3_porter.c"
120842121383
/*
120843121384
** 2006 September 30
120844121385
**
120845121386
** The author disclaims copyright to this source code. In place of
120846121387
** a legal notice, here is a blessing:
@@ -121483,10 +122024,11 @@
121483122024
121484122025
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
121485122026
121486122027
/************** End of fts3_porter.c *****************************************/
121487122028
/************** Begin file fts3_tokenizer.c **********************************/
122029
+#line 1 "tsrc/fts3_tokenizer.c"
121488122030
/*
121489122031
** 2007 June 22
121490122032
**
121491122033
** The author disclaims copyright to this source code. In place of
121492122034
** a legal notice, here is a blessing:
@@ -121974,10 +122516,11 @@
121974122516
121975122517
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
121976122518
121977122519
/************** End of fts3_tokenizer.c **************************************/
121978122520
/************** Begin file fts3_tokenizer1.c *********************************/
122521
+#line 1 "tsrc/fts3_tokenizer1.c"
121979122522
/*
121980122523
** 2006 Oct 10
121981122524
**
121982122525
** The author disclaims copyright to this source code. In place of
121983122526
** a legal notice, here is a blessing:
@@ -122208,10 +122751,11 @@
122208122751
122209122752
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
122210122753
122211122754
/************** End of fts3_tokenizer1.c *************************************/
122212122755
/************** Begin file fts3_write.c **************************************/
122756
+#line 1 "tsrc/fts3_write.c"
122213122757
/*
122214122758
** 2009 Oct 23
122215122759
**
122216122760
** The author disclaims copyright to this source code. In place of
122217122761
** a legal notice, here is a blessing:
@@ -125478,10 +126022,11 @@
125478126022
125479126023
#endif
125480126024
125481126025
/************** End of fts3_write.c ******************************************/
125482126026
/************** Begin file fts3_snippet.c ************************************/
126027
+#line 1 "tsrc/fts3_snippet.c"
125483126028
/*
125484126029
** 2009 Oct 23
125485126030
**
125486126031
** The author disclaims copyright to this source code. In place of
125487126032
** a legal notice, here is a blessing:
@@ -126979,10 +127524,11 @@
126979127524
126980127525
#endif
126981127526
126982127527
/************** End of fts3_snippet.c ****************************************/
126983127528
/************** Begin file rtree.c *******************************************/
127529
+#line 1 "tsrc/rtree.c"
126984127530
/*
126985127531
** 2001 September 15
126986127532
**
126987127533
** The author disclaims copyright to this source code. In place of
126988127534
** a legal notice, here is a blessing:
@@ -130260,10 +130806,11 @@
130260130806
130261130807
#endif
130262130808
130263130809
/************** End of rtree.c ***********************************************/
130264130810
/************** Begin file icu.c *********************************************/
130811
+#line 1 "tsrc/icu.c"
130265130812
/*
130266130813
** 2007 May 6
130267130814
**
130268130815
** The author disclaims copyright to this source code. In place of
130269130816
** a legal notice, here is a blessing:
@@ -130762,10 +131309,11 @@
130762131309
130763131310
#endif
130764131311
130765131312
/************** End of icu.c *************************************************/
130766131313
/************** Begin file fts3_icu.c ****************************************/
131314
+#line 1 "tsrc/fts3_icu.c"
130767131315
/*
130768131316
** 2007 June 22
130769131317
**
130770131318
** The author disclaims copyright to this source code. In place of
130771131319
** a legal notice, here is a blessing:
130772131320
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -24,10 +24,11 @@
24 #endif
25 #ifndef SQLITE_API
26 # define SQLITE_API
27 #endif
28 /************** Begin file sqliteInt.h ***************************************/
 
29 /*
30 ** 2001 September 15
31 **
32 ** The author disclaims copyright to this source code. In place of
33 ** a legal notice, here is a blessing:
@@ -78,10 +79,11 @@
78 #include "config.h"
79 #endif
80
81 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
82 /************** Begin file sqliteLimit.h *************************************/
 
83 /*
84 ** 2007 May 7
85 **
86 ** The author disclaims copyright to this source code. In place of
87 ** a legal notice, here is a blessing:
@@ -289,10 +291,11 @@
289 # define SQLITE_MAX_TRIGGER_DEPTH 1000
290 #endif
291
292 /************** End of sqliteLimit.h *****************************************/
293 /************** Continuing where we left off in sqliteInt.h ******************/
 
294
295 /* Disable nuisance warnings on Borland compilers */
296 #if defined(__BORLANDC__)
297 #pragma warn -rch /* unreachable code */
298 #pragma warn -ccc /* Condition is always true or false */
@@ -545,10 +548,11 @@
545 # define unlikely(X) !!(X)
546 #endif
547
548 /************** Include sqlite3.h in the middle of sqliteInt.h ***************/
549 /************** Begin file sqlite3.h *****************************************/
 
550 /*
551 ** 2001 September 15
552 **
553 ** The author disclaims copyright to this source code. In place of
554 ** a legal notice, here is a blessing:
@@ -656,11 +660,11 @@
656 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657 ** [sqlite_version()] and [sqlite_source_id()].
658 */
659 #define SQLITE_VERSION "3.7.8"
660 #define SQLITE_VERSION_NUMBER 3007008
661 #define SQLITE_SOURCE_ID "2011-09-04 01:27:00 6b657ae75035eb10b0ad640998d3c9eadfdffa6e"
662
663 /*
664 ** CAPI3REF: Run-Time Library Version Numbers
665 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
666 **
@@ -7305,12 +7309,14 @@
7305 #endif /* ifndef _SQLITE3RTREE_H_ */
7306
7307
7308 /************** End of sqlite3.h *********************************************/
7309 /************** Continuing where we left off in sqliteInt.h ******************/
 
7310 /************** Include hash.h in the middle of sqliteInt.h ******************/
7311 /************** Begin file hash.h ********************************************/
 
7312 /*
7313 ** 2001 September 22
7314 **
7315 ** The author disclaims copyright to this source code. In place of
7316 ** a legal notice, here is a blessing:
@@ -7406,12 +7412,14 @@
7406
7407 #endif /* _SQLITE_HASH_H_ */
7408
7409 /************** End of hash.h ************************************************/
7410 /************** Continuing where we left off in sqliteInt.h ******************/
 
7411 /************** Include parse.h in the middle of sqliteInt.h *****************/
7412 /************** Begin file parse.h *******************************************/
 
7413 #define TK_SEMI 1
7414 #define TK_EXPLAIN 2
7415 #define TK_QUERY 3
7416 #define TK_PLAN 4
7417 #define TK_BEGIN 5
@@ -7568,10 +7576,11 @@
7568 #define TK_UMINUS 156
7569 #define TK_UPLUS 157
7570
7571 /************** End of parse.h ***********************************************/
7572 /************** Continuing where we left off in sqliteInt.h ******************/
 
7573 #include <stdio.h>
7574 #include <stdlib.h>
7575 #include <string.h>
7576 #include <assert.h>
7577 #include <stddef.h>
@@ -7911,10 +7920,11 @@
7911 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
7912 ** pointer types (i.e. FuncDef) defined above.
7913 */
7914 /************** Include btree.h in the middle of sqliteInt.h *****************/
7915 /************** Begin file btree.h *******************************************/
 
7916 /*
7917 ** 2001 September 15
7918 **
7919 ** The author disclaims copyright to this source code. In place of
7920 ** a legal notice, here is a blessing:
@@ -8155,12 +8165,14 @@
8155
8156 #endif /* _BTREE_H_ */
8157
8158 /************** End of btree.h ***********************************************/
8159 /************** Continuing where we left off in sqliteInt.h ******************/
 
8160 /************** Include vdbe.h in the middle of sqliteInt.h ******************/
8161 /************** Begin file vdbe.h ********************************************/
 
8162 /*
8163 ** 2001 September 15
8164 **
8165 ** The author disclaims copyright to this source code. In place of
8166 ** a legal notice, here is a blessing:
@@ -8321,10 +8333,11 @@
8321 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
8322 ** header file that defines a number for each opcode used by the VDBE.
8323 */
8324 /************** Include opcodes.h in the middle of vdbe.h ********************/
8325 /************** Begin file opcodes.h *****************************************/
 
8326 /* Automatically generated. Do not edit */
8327 /* See the mkopcodeh.awk script for details */
8328 #define OP_Goto 1
8329 #define OP_Gosub 2
8330 #define OP_Return 3
@@ -8508,10 +8521,11 @@
8508 /* 136 */ 0x00, 0x01, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04,\
8509 /* 144 */ 0x04, 0x04, 0x02, 0x00, 0x00, 0x00,}
8510
8511 /************** End of opcodes.h *********************************************/
8512 /************** Continuing where we left off in vdbe.h ***********************/
 
8513
8514 /*
8515 ** Prototypes for the VDBE interface. See comments on the implementation
8516 ** for a description of what each of these routines does.
8517 */
@@ -8559,13 +8573,13 @@
8559 SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);
8560 #ifndef SQLITE_OMIT_TRACE
8561 SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
8562 #endif
8563
8564 SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int);
8565 SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
8566 SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
 
8567
8568 #ifndef SQLITE_OMIT_TRIGGER
8569 SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
8570 #endif
8571
@@ -8582,12 +8596,14 @@
8582
8583 #endif
8584
8585 /************** End of vdbe.h ************************************************/
8586 /************** Continuing where we left off in sqliteInt.h ******************/
 
8587 /************** Include pager.h in the middle of sqliteInt.h *****************/
8588 /************** Begin file pager.h *******************************************/
 
8589 /*
8590 ** 2001 September 15
8591 **
8592 ** The author disclaims copyright to this source code. In place of
8593 ** a legal notice, here is a blessing:
@@ -8769,12 +8785,14 @@
8769
8770 #endif /* _PAGER_H_ */
8771
8772 /************** End of pager.h ***********************************************/
8773 /************** Continuing where we left off in sqliteInt.h ******************/
 
8774 /************** Include pcache.h in the middle of sqliteInt.h ****************/
8775 /************** Begin file pcache.h ******************************************/
 
8776 /*
8777 ** 2008 August 05
8778 **
8779 ** The author disclaims copyright to this source code. In place of
8780 ** a legal notice, here is a blessing:
@@ -8929,13 +8947,15 @@
8929
8930 #endif /* _PCACHE_H_ */
8931
8932 /************** End of pcache.h **********************************************/
8933 /************** Continuing where we left off in sqliteInt.h ******************/
 
8934
8935 /************** Include os.h in the middle of sqliteInt.h ********************/
8936 /************** Begin file os.h **********************************************/
 
8937 /*
8938 ** 2001 September 16
8939 **
8940 ** The author disclaims copyright to this source code. In place of
8941 ** a legal notice, here is a blessing:
@@ -9214,12 +9234,14 @@
9214
9215 #endif /* _SQLITE_OS_H_ */
9216
9217 /************** End of os.h **************************************************/
9218 /************** Continuing where we left off in sqliteInt.h ******************/
 
9219 /************** Include mutex.h in the middle of sqliteInt.h *****************/
9220 /************** Begin file mutex.h *******************************************/
 
9221 /*
9222 ** 2007 August 28
9223 **
9224 ** The author disclaims copyright to this source code. In place of
9225 ** a legal notice, here is a blessing:
@@ -9290,10 +9312,11 @@
9290 #define sqlite3MutexEnd()
9291 #endif /* defined(SQLITE_MUTEX_OMIT) */
9292
9293 /************** End of mutex.h ***********************************************/
9294 /************** Continuing where we left off in sqliteInt.h ******************/
 
9295
9296
9297 /*
9298 ** Each database file to be accessed by the system is an instance
9299 ** of the following structure. There are normally two of these structures
@@ -11892,10 +11915,11 @@
11892
11893 #endif /* _SQLITEINT_H_ */
11894
11895 /************** End of sqliteInt.h *******************************************/
11896 /************** Begin file global.c ******************************************/
 
11897 /*
11898 ** 2008 June 13
11899 **
11900 ** The author disclaims copyright to this source code. In place of
11901 ** a legal notice, here is a blessing:
@@ -12114,10 +12138,11 @@
12114 */
12115 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
12116
12117 /************** End of global.c **********************************************/
12118 /************** Begin file ctime.c *******************************************/
 
12119 /*
12120 ** 2010 February 23
12121 **
12122 ** The author disclaims copyright to this source code. In place of
12123 ** a legal notice, here is a blessing:
@@ -12518,10 +12543,11 @@
12518
12519 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
12520
12521 /************** End of ctime.c ***********************************************/
12522 /************** Begin file status.c ******************************************/
 
12523 /*
12524 ** 2008 June 18
12525 **
12526 ** The author disclaims copyright to this source code. In place of
12527 ** a legal notice, here is a blessing:
@@ -12535,10 +12561,11 @@
12535 ** This module implements the sqlite3_status() interface and related
12536 ** functionality.
12537 */
12538 /************** Include vdbeInt.h in the middle of status.c ******************/
12539 /************** Begin file vdbeInt.h *****************************************/
 
12540 /*
12541 ** 2003 September 6
12542 **
12543 ** The author disclaims copyright to this source code. In place of
12544 ** a legal notice, here is a blessing:
@@ -12986,10 +13013,11 @@
12986
12987 #endif /* !defined(_VDBEINT_H_) */
12988
12989 /************** End of vdbeInt.h *********************************************/
12990 /************** Continuing where we left off in status.c *********************/
 
12991
12992 /*
12993 ** Variables in which to record status information.
12994 */
12995 typedef struct sqlite3StatType sqlite3StatType;
@@ -13199,10 +13227,11 @@
13199 return rc;
13200 }
13201
13202 /************** End of status.c **********************************************/
13203 /************** Begin file date.c ********************************************/
 
13204 /*
13205 ** 2003 October 31
13206 **
13207 ** The author disclaims copyright to this source code. In place of
13208 ** a legal notice, here is a blessing:
@@ -14326,10 +14355,11 @@
14326 }
14327 }
14328
14329 /************** End of date.c ************************************************/
14330 /************** Begin file os.c **********************************************/
 
14331 /*
14332 ** 2005 November 29
14333 **
14334 ** The author disclaims copyright to this source code. In place of
14335 ** a legal notice, here is a blessing:
@@ -14659,10 +14689,11 @@
14659 return SQLITE_OK;
14660 }
14661
14662 /************** End of os.c **************************************************/
14663 /************** Begin file fault.c *******************************************/
 
14664 /*
14665 ** 2008 Jan 22
14666 **
14667 ** The author disclaims copyright to this source code. In place of
14668 ** a legal notice, here is a blessing:
@@ -14748,10 +14779,11 @@
14748
14749 #endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */
14750
14751 /************** End of fault.c ***********************************************/
14752 /************** Begin file mem0.c ********************************************/
 
14753 /*
14754 ** 2008 October 28
14755 **
14756 ** The author disclaims copyright to this source code. In place of
14757 ** a legal notice, here is a blessing:
@@ -14809,10 +14841,11 @@
14809
14810 #endif /* SQLITE_ZERO_MALLOC */
14811
14812 /************** End of mem0.c ************************************************/
14813 /************** Begin file mem1.c ********************************************/
 
14814 /*
14815 ** 2007 August 14
14816 **
14817 ** The author disclaims copyright to this source code. In place of
14818 ** a legal notice, here is a blessing:
@@ -14961,10 +14994,11 @@
14961
14962 #endif /* SQLITE_SYSTEM_MALLOC */
14963
14964 /************** End of mem1.c ************************************************/
14965 /************** Begin file mem2.c ********************************************/
 
14966 /*
14967 ** 2007 August 15
14968 **
14969 ** The author disclaims copyright to this source code. In place of
14970 ** a legal notice, here is a blessing:
@@ -15491,10 +15525,11 @@
15491
15492 #endif /* SQLITE_MEMDEBUG */
15493
15494 /************** End of mem2.c ************************************************/
15495 /************** Begin file mem3.c ********************************************/
 
15496 /*
15497 ** 2007 October 14
15498 **
15499 ** The author disclaims copyright to this source code. In place of
15500 ** a legal notice, here is a blessing:
@@ -16180,10 +16215,11 @@
16180
16181 #endif /* SQLITE_ENABLE_MEMSYS3 */
16182
16183 /************** End of mem3.c ************************************************/
16184 /************** Begin file mem5.c ********************************************/
 
16185 /*
16186 ** 2007 October 14
16187 **
16188 ** The author disclaims copyright to this source code. In place of
16189 ** a legal notice, here is a blessing:
@@ -16763,10 +16799,11 @@
16763
16764 #endif /* SQLITE_ENABLE_MEMSYS5 */
16765
16766 /************** End of mem5.c ************************************************/
16767 /************** Begin file mutex.c *******************************************/
 
16768 /*
16769 ** 2007 August 14
16770 **
16771 ** The author disclaims copyright to this source code. In place of
16772 ** a legal notice, here is a blessing:
@@ -16918,10 +16955,11 @@
16918
16919 #endif /* SQLITE_MUTEX_OMIT */
16920
16921 /************** End of mutex.c ***********************************************/
16922 /************** Begin file mutex_noop.c **************************************/
 
16923 /*
16924 ** 2008 October 07
16925 **
16926 ** The author disclaims copyright to this source code. In place of
16927 ** a legal notice, here is a blessing:
@@ -17126,10 +17164,11 @@
17126 #endif /* SQLITE_MUTEX_NOOP */
17127 #endif /* SQLITE_MUTEX_OMIT */
17128
17129 /************** End of mutex_noop.c ******************************************/
17130 /************** Begin file mutex_os2.c ***************************************/
 
17131 /*
17132 ** 2007 August 28
17133 **
17134 ** The author disclaims copyright to this source code. In place of
17135 ** a legal notice, here is a blessing:
@@ -17402,10 +17441,11 @@
17402 }
17403 #endif /* SQLITE_MUTEX_OS2 */
17404
17405 /************** End of mutex_os2.c *******************************************/
17406 /************** Begin file mutex_unix.c **************************************/
 
17407 /*
17408 ** 2007 August 28
17409 **
17410 ** The author disclaims copyright to this source code. In place of
17411 ** a legal notice, here is a blessing:
@@ -17755,10 +17795,11 @@
17755
17756 #endif /* SQLITE_MUTEX_PTHREAD */
17757
17758 /************** End of mutex_unix.c ******************************************/
17759 /************** Begin file mutex_w32.c ***************************************/
 
17760 /*
17761 ** 2007 August 14
17762 **
17763 ** The author disclaims copyright to this source code. In place of
17764 ** a legal notice, here is a blessing:
@@ -18089,10 +18130,11 @@
18089 }
18090 #endif /* SQLITE_MUTEX_W32 */
18091
18092 /************** End of mutex_w32.c *******************************************/
18093 /************** Begin file malloc.c ******************************************/
 
18094 /*
18095 ** 2001 September 15
18096 **
18097 ** The author disclaims copyright to this source code. In place of
18098 ** a legal notice, here is a blessing:
@@ -18868,10 +18910,11 @@
18868 return rc & (db ? db->errMask : 0xff);
18869 }
18870
18871 /************** End of malloc.c **********************************************/
18872 /************** Begin file printf.c ******************************************/
 
18873 /*
18874 ** The "printf" code that follows dates from the 1980's. It is in
18875 ** the public domain. The original comments are included here for
18876 ** completeness. They are very out-of-date but might be useful as
18877 ** an historical reference. Most of the "enhancements" have been backed
@@ -19899,10 +19942,11 @@
19899 }
19900 #endif
19901
19902 /************** End of printf.c **********************************************/
19903 /************** Begin file random.c ******************************************/
 
19904 /*
19905 ** 2001 September 15
19906 **
19907 ** The author disclaims copyright to this source code. In place of
19908 ** a legal notice, here is a blessing:
@@ -20046,10 +20090,11 @@
20046 }
20047 #endif /* SQLITE_OMIT_BUILTIN_TEST */
20048
20049 /************** End of random.c **********************************************/
20050 /************** Begin file utf.c *********************************************/
 
20051 /*
20052 ** 2004 April 13
20053 **
20054 ** The author disclaims copyright to this source code. In place of
20055 ** a legal notice, here is a blessing:
@@ -20607,10 +20652,11 @@
20607 #endif /* SQLITE_TEST */
20608 #endif /* SQLITE_OMIT_UTF16 */
20609
20610 /************** End of utf.c *************************************************/
20611 /************** Begin file util.c ********************************************/
 
20612 /*
20613 ** 2001 September 15
20614 **
20615 ** The author disclaims copyright to this source code. In place of
20616 ** a legal notice, here is a blessing:
@@ -21789,10 +21835,11 @@
21789 }
21790 #endif
21791
21792 /************** End of util.c ************************************************/
21793 /************** Begin file hash.c ********************************************/
 
21794 /*
21795 ** 2001 September 22
21796 **
21797 ** The author disclaims copyright to this source code. In place of
21798 ** a legal notice, here is a blessing:
@@ -22068,10 +22115,11 @@
22068 return 0;
22069 }
22070
22071 /************** End of hash.c ************************************************/
22072 /************** Begin file opcodes.c *****************************************/
 
22073 /* Automatically generated. Do not edit */
22074 /* See the mkopcodec.awk script for details. */
22075 #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
22076 SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
22077 static const char *const azName[] = { "?",
@@ -22229,10 +22277,11 @@
22229 }
22230 #endif
22231
22232 /************** End of opcodes.c *********************************************/
22233 /************** Begin file os_os2.c ******************************************/
 
22234 /*
22235 ** 2006 Feb 14
22236 **
22237 ** The author disclaims copyright to this source code. In place of
22238 ** a legal notice, here is a blessing:
@@ -22285,10 +22334,11 @@
22285 /*
22286 ** Include code that is common to all os_*.c files
22287 */
22288 /************** Include os_common.h in the middle of os_os2.c ****************/
22289 /************** Begin file os_common.h ***************************************/
 
22290 /*
22291 ** 2004 May 22
22292 **
22293 ** The author disclaims copyright to this source code. In place of
22294 ** a legal notice, here is a blessing:
@@ -22338,10 +22388,11 @@
22338 ** hwtime.h contains inline assembler code for implementing
22339 ** high-performance timing routines.
22340 */
22341 /************** Include hwtime.h in the middle of os_common.h ****************/
22342 /************** Begin file hwtime.h ******************************************/
 
22343 /*
22344 ** 2008 May 27
22345 **
22346 ** The author disclaims copyright to this source code. In place of
22347 ** a legal notice, here is a blessing:
@@ -22426,10 +22477,11 @@
22426
22427 #endif /* !defined(_HWTIME_H_) */
22428
22429 /************** End of hwtime.h **********************************************/
22430 /************** Continuing where we left off in os_common.h ******************/
 
22431
22432 static sqlite_uint64 g_start;
22433 static sqlite_uint64 g_elapsed;
22434 #define TIMER_START g_start=sqlite3Hwtime()
22435 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -22492,10 +22544,11 @@
22492
22493 #endif /* !defined(_OS_COMMON_H_) */
22494
22495 /************** End of os_common.h *******************************************/
22496 /************** Continuing where we left off in os_os2.c *********************/
 
22497
22498 /* Forward references */
22499 typedef struct os2File os2File; /* The file structure */
22500 typedef struct os2ShmNode os2ShmNode; /* A shared descritive memory node */
22501 typedef struct os2ShmLink os2ShmLink; /* A connection to shared-memory */
@@ -24363,10 +24416,11 @@
24363
24364 #endif /* SQLITE_OS_OS2 */
24365
24366 /************** End of os_os2.c **********************************************/
24367 /************** Begin file os_unix.c *****************************************/
 
24368 /*
24369 ** 2004 May 22
24370 **
24371 ** The author disclaims copyright to this source code. In place of
24372 ** a legal notice, here is a blessing:
@@ -24627,10 +24681,11 @@
24627 /*
24628 ** Include code that is common to all os_*.c files
24629 */
24630 /************** Include os_common.h in the middle of os_unix.c ***************/
24631 /************** Begin file os_common.h ***************************************/
 
24632 /*
24633 ** 2004 May 22
24634 **
24635 ** The author disclaims copyright to this source code. In place of
24636 ** a legal notice, here is a blessing:
@@ -24680,10 +24735,11 @@
24680 ** hwtime.h contains inline assembler code for implementing
24681 ** high-performance timing routines.
24682 */
24683 /************** Include hwtime.h in the middle of os_common.h ****************/
24684 /************** Begin file hwtime.h ******************************************/
 
24685 /*
24686 ** 2008 May 27
24687 **
24688 ** The author disclaims copyright to this source code. In place of
24689 ** a legal notice, here is a blessing:
@@ -24768,10 +24824,11 @@
24768
24769 #endif /* !defined(_HWTIME_H_) */
24770
24771 /************** End of hwtime.h **********************************************/
24772 /************** Continuing where we left off in os_common.h ******************/
 
24773
24774 static sqlite_uint64 g_start;
24775 static sqlite_uint64 g_elapsed;
24776 #define TIMER_START g_start=sqlite3Hwtime()
24777 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -24834,10 +24891,11 @@
24834
24835 #endif /* !defined(_OS_COMMON_H_) */
24836
24837 /************** End of os_common.h *******************************************/
24838 /************** Continuing where we left off in os_unix.c ********************/
 
24839
24840 /*
24841 ** Define various macros that are missing from some systems.
24842 */
24843 #ifndef O_LARGEFILE
@@ -31343,10 +31401,11 @@
31343
31344 #endif /* SQLITE_OS_UNIX */
31345
31346 /************** End of os_unix.c *********************************************/
31347 /************** Begin file os_win.c ******************************************/
 
31348 /*
31349 ** 2004 May 22
31350 **
31351 ** The author disclaims copyright to this source code. In place of
31352 ** a legal notice, here is a blessing:
@@ -31404,10 +31463,11 @@
31404 /*
31405 ** Include code that is common to all os_*.c files
31406 */
31407 /************** Include os_common.h in the middle of os_win.c ****************/
31408 /************** Begin file os_common.h ***************************************/
 
31409 /*
31410 ** 2004 May 22
31411 **
31412 ** The author disclaims copyright to this source code. In place of
31413 ** a legal notice, here is a blessing:
@@ -31457,10 +31517,11 @@
31457 ** hwtime.h contains inline assembler code for implementing
31458 ** high-performance timing routines.
31459 */
31460 /************** Include hwtime.h in the middle of os_common.h ****************/
31461 /************** Begin file hwtime.h ******************************************/
 
31462 /*
31463 ** 2008 May 27
31464 **
31465 ** The author disclaims copyright to this source code. In place of
31466 ** a legal notice, here is a blessing:
@@ -31545,10 +31606,11 @@
31545
31546 #endif /* !defined(_HWTIME_H_) */
31547
31548 /************** End of hwtime.h **********************************************/
31549 /************** Continuing where we left off in os_common.h ******************/
 
31550
31551 static sqlite_uint64 g_start;
31552 static sqlite_uint64 g_elapsed;
31553 #define TIMER_START g_start=sqlite3Hwtime()
31554 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -31611,10 +31673,11 @@
31611
31612 #endif /* !defined(_OS_COMMON_H_) */
31613
31614 /************** End of os_common.h *******************************************/
31615 /************** Continuing where we left off in os_win.c *********************/
 
31616
31617 /*
31618 ** Some microsoft compilers lack this definition.
31619 */
31620 #ifndef INVALID_FILE_ATTRIBUTES
@@ -34746,10 +34809,11 @@
34746
34747 #endif /* SQLITE_OS_WIN */
34748
34749 /************** End of os_win.c **********************************************/
34750 /************** Begin file bitvec.c ******************************************/
 
34751 /*
34752 ** 2008 February 16
34753 **
34754 ** The author disclaims copyright to this source code. In place of
34755 ** a legal notice, here is a blessing:
@@ -35156,10 +35220,11 @@
35156 }
35157 #endif /* SQLITE_OMIT_BUILTIN_TEST */
35158
35159 /************** End of bitvec.c **********************************************/
35160 /************** Begin file pcache.c ******************************************/
 
35161 /*
35162 ** 2008 August 05
35163 **
35164 ** The author disclaims copyright to this source code. In place of
35165 ** a legal notice, here is a blessing:
@@ -35752,10 +35817,11 @@
35752 }
35753 #endif
35754
35755 /************** End of pcache.c **********************************************/
35756 /************** Begin file pcache1.c *****************************************/
 
35757 /*
35758 ** 2008 November 05
35759 **
35760 ** The author disclaims copyright to this source code. In place of
35761 ** a legal notice, here is a blessing:
@@ -36968,10 +37034,11 @@
36968 }
36969 #endif
36970
36971 /************** End of pcache1.c *********************************************/
36972 /************** Begin file rowset.c ******************************************/
 
36973 /*
36974 ** 2008 December 3
36975 **
36976 ** The author disclaims copyright to this source code. In place of
36977 ** a legal notice, here is a blessing:
@@ -37392,10 +37459,11 @@
37392 return 0;
37393 }
37394
37395 /************** End of rowset.c **********************************************/
37396 /************** Begin file pager.c *******************************************/
 
37397 /*
37398 ** 2001 September 15
37399 **
37400 ** The author disclaims copyright to this source code. In place of
37401 ** a legal notice, here is a blessing:
@@ -37415,10 +37483,11 @@
37415 ** another is writing.
37416 */
37417 #ifndef SQLITE_OMIT_DISKIO
37418 /************** Include wal.h in the middle of pager.c ***********************/
37419 /************** Begin file wal.h *********************************************/
 
37420 /*
37421 ** 2010 February 1
37422 **
37423 ** The author disclaims copyright to this source code. In place of
37424 ** a legal notice, here is a blessing:
@@ -37539,10 +37608,11 @@
37539 #endif /* ifndef SQLITE_OMIT_WAL */
37540 #endif /* _WAL_H_ */
37541
37542 /************** End of wal.h *************************************************/
37543 /************** Continuing where we left off in pager.c **********************/
 
37544
37545
37546 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
37547 **
37548 ** This comment block describes invariants that hold when using a rollback
@@ -44352,10 +44422,11 @@
44352
44353 #endif /* SQLITE_OMIT_DISKIO */
44354
44355 /************** End of pager.c ***********************************************/
44356 /************** Begin file wal.c *********************************************/
 
44357 /*
44358 ** 2010 February 1
44359 **
44360 ** The author disclaims copyright to this source code. In place of
44361 ** a legal notice, here is a blessing:
@@ -47306,10 +47377,11 @@
47306
47307 #endif /* #ifndef SQLITE_OMIT_WAL */
47308
47309 /************** End of wal.c *************************************************/
47310 /************** Begin file btmutex.c *****************************************/
 
47311 /*
47312 ** 2007 August 27
47313 **
47314 ** The author disclaims copyright to this source code. In place of
47315 ** a legal notice, here is a blessing:
@@ -47325,10 +47397,11 @@
47325 ** big and we want to break it down some. This packaged seemed like
47326 ** a good breakout.
47327 */
47328 /************** Include btreeInt.h in the middle of btmutex.c ****************/
47329 /************** Begin file btreeInt.h ****************************************/
 
47330 /*
47331 ** 2004 April 6
47332 **
47333 ** The author disclaims copyright to this source code. In place of
47334 ** a legal notice, here is a blessing:
@@ -47970,10 +48043,11 @@
47970 #define get4byte sqlite3Get4byte
47971 #define put4byte sqlite3Put4byte
47972
47973 /************** End of btreeInt.h ********************************************/
47974 /************** Continuing where we left off in btmutex.c ********************/
 
47975 #ifndef SQLITE_OMIT_SHARED_CACHE
47976 #if SQLITE_THREADSAFE
47977
47978 /*
47979 ** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -48242,10 +48316,11 @@
48242 #endif /* if SQLITE_THREADSAFE */
48243 #endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
48244
48245 /************** End of btmutex.c *********************************************/
48246 /************** Begin file btree.c *******************************************/
 
48247 /*
48248 ** 2004 April 6
48249 **
48250 ** The author disclaims copyright to this source code. In place of
48251 ** a legal notice, here is a blessing:
@@ -48899,22 +48974,25 @@
48899 int *pRes /* Write search results here */
48900 ){
48901 int rc; /* Status code */
48902 UnpackedRecord *pIdxKey; /* Unpacked index key */
48903 char aSpace[150]; /* Temp space for pIdxKey - to avoid a malloc */
 
48904
48905 if( pKey ){
48906 assert( nKey==(i64)(int)nKey );
48907 pIdxKey = sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey,
48908 aSpace, sizeof(aSpace));
 
48909 if( pIdxKey==0 ) return SQLITE_NOMEM;
 
48910 }else{
48911 pIdxKey = 0;
48912 }
48913 rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
48914 if( pKey ){
48915 sqlite3VdbeDeleteUnpackedRecord(pIdxKey);
48916 }
48917 return rc;
48918 }
48919
48920 /*
@@ -56426,10 +56504,11 @@
56426 return rc;
56427 }
56428
56429 /************** End of btree.c ***********************************************/
56430 /************** Begin file backup.c ******************************************/
 
56431 /*
56432 ** 2009 January 28
56433 **
56434 ** The author disclaims copyright to this source code. In place of
56435 ** a legal notice, here is a blessing:
@@ -57132,10 +57211,11 @@
57132 }
57133 #endif /* SQLITE_OMIT_VACUUM */
57134
57135 /************** End of backup.c **********************************************/
57136 /************** Begin file vdbemem.c *****************************************/
 
57137 /*
57138 ** 2004 May 26
57139 **
57140 ** The author disclaims copyright to this source code. In place of
57141 ** a legal notice, here is a blessing:
@@ -58286,10 +58366,11 @@
58286 return 0;
58287 }
58288
58289 /************** End of vdbemem.c *********************************************/
58290 /************** Begin file vdbeaux.c *****************************************/
 
58291 /*
58292 ** 2003 September 6
58293 **
58294 ** The author disclaims copyright to this source code. In place of
58295 ** a legal notice, here is a blessing:
@@ -61116,61 +61197,74 @@
61116 }
61117 }
61118 return 0;
61119 }
61120
61121
61122 /*
61123 ** Given the nKey-byte encoding of a record in pKey[], parse the
61124 ** record into a UnpackedRecord structure. Return a pointer to
61125 ** that structure.
61126 **
61127 ** The calling function might provide szSpace bytes of memory
61128 ** space at pSpace. This space can be used to hold the returned
61129 ** VDbeParsedRecord structure if it is large enough. If it is
61130 ** not big enough, space is obtained from sqlite3_malloc().
61131 **
61132 ** The returned structure should be closed by a call to
61133 ** sqlite3VdbeDeleteUnpackedRecord().
61134 */
61135 SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(
61136 KeyInfo *pKeyInfo, /* Information about the record format */
61137 int nKey, /* Size of the binary record */
61138 const void *pKey, /* The binary record */
61139 char *pSpace, /* Unaligned space available to hold the object */
61140 int szSpace /* Size of pSpace[] in bytes */
61141 ){
61142 const unsigned char *aKey = (const unsigned char *)pKey;
61143 UnpackedRecord *p; /* The unpacked record that we will return */
61144 int nByte; /* Memory space needed to hold p, in bytes */
61145 int d;
61146 u32 idx;
61147 u16 u; /* Unsigned loop counter */
61148 u32 szHdr;
61149 Mem *pMem;
61150 int nOff; /* Increase pSpace by this much to 8-byte align it */
61151
61152 /*
61153 ** We want to shift the pointer pSpace up such that it is 8-byte aligned.
61154 ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift
61155 ** it by. If pSpace is already 8-byte aligned, nOff should be zero.
61156 */
61157 nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;
61158 pSpace += nOff;
61159 szSpace -= nOff;
61160 nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
61161 if( nByte>szSpace ){
61162 p = sqlite3DbMallocRaw(pKeyInfo->db, nByte);
61163 if( p==0 ) return 0;
61164 p->flags = UNPACKED_NEED_FREE | UNPACKED_NEED_DESTROY;
61165 }else{
61166 p = (UnpackedRecord*)pSpace;
61167 p->flags = UNPACKED_NEED_DESTROY;
61168 }
 
 
61169 p->pKeyInfo = pKeyInfo;
61170 p->nField = pKeyInfo->nField + 1;
61171 p->aMem = pMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61172 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
61173 idx = getVarint32(aKey, szHdr);
61174 d = szHdr;
61175 u = 0;
61176 while( idx<szHdr && u<p->nField && d<=nKey ){
@@ -61185,35 +61279,10 @@
61185 pMem++;
61186 u++;
61187 }
61188 assert( u<=pKeyInfo->nField + 1 );
61189 p->nField = u;
61190 return (void*)p;
61191 }
61192
61193 /*
61194 ** This routine destroys a UnpackedRecord object.
61195 */
61196 SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord *p){
61197 #ifdef SQLITE_DEBUG
61198 int i;
61199 Mem *pMem;
61200
61201 assert( p!=0 );
61202 assert( p->flags & UNPACKED_NEED_DESTROY );
61203 for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
61204 /* The unpacked record is always constructed by the
61205 ** sqlite3VdbeUnpackRecord() function above, which makes all
61206 ** strings and blobs static. And none of the elements are
61207 ** ever transformed, so there is never anything to delete.
61208 */
61209 if( NEVER(pMem->zMalloc) ) sqlite3VdbeMemRelease(pMem);
61210 }
61211 #endif
61212 if( p->flags & UNPACKED_NEED_FREE ){
61213 sqlite3DbFree(p->pKeyInfo->db, p);
61214 }
61215 }
61216
61217 /*
61218 ** This function compares the two table rows or index records
61219 ** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
@@ -61540,10 +61609,11 @@
61540 }
61541 }
61542
61543 /************** End of vdbeaux.c *********************************************/
61544 /************** Begin file vdbeapi.c *****************************************/
 
61545 /*
61546 ** 2004 May 26
61547 **
61548 ** The author disclaims copyright to this source code. In place of
61549 ** a legal notice, here is a blessing:
@@ -62847,10 +62917,11 @@
62847 return v;
62848 }
62849
62850 /************** End of vdbeapi.c *********************************************/
62851 /************** Begin file vdbetrace.c ***************************************/
 
62852 /*
62853 ** 2009 November 25
62854 **
62855 ** The author disclaims copyright to this source code. In place of
62856 ** a legal notice, here is a blessing:
@@ -63002,10 +63073,11 @@
63002
63003 #endif /* #ifndef SQLITE_OMIT_TRACE */
63004
63005 /************** End of vdbetrace.c *******************************************/
63006 /************** Begin file vdbe.c ********************************************/
 
63007 /*
63008 ** 2001 September 15
63009 **
63010 ** The author disclaims copyright to this source code. In place of
63011 ** a legal notice, here is a blessing:
@@ -63471,10 +63543,11 @@
63471 ** hwtime.h contains inline assembler code for implementing
63472 ** high-performance timing routines.
63473 */
63474 /************** Include hwtime.h in the middle of vdbe.c *********************/
63475 /************** Begin file hwtime.h ******************************************/
 
63476 /*
63477 ** 2008 May 27
63478 **
63479 ** The author disclaims copyright to this source code. In place of
63480 ** a legal notice, here is a blessing:
@@ -63559,10 +63632,11 @@
63559
63560 #endif /* !defined(_HWTIME_H_) */
63561
63562 /************** End of hwtime.h **********************************************/
63563 /************** Continuing where we left off in vdbe.c ***********************/
 
63564
63565 #endif
63566
63567 /*
63568 ** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
@@ -63853,10 +63927,11 @@
63853 } bb;
63854 struct OP_Found_stack_vars {
63855 int alreadyExists;
63856 VdbeCursor *pC;
63857 int res;
 
63858 UnpackedRecord *pIdxKey;
63859 UnpackedRecord r;
63860 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
63861 } bc;
63862 struct OP_IsUnique_stack_vars {
@@ -67097,10 +67172,11 @@
67097 case OP_Found: { /* jump, in3 */
67098 #if 0 /* local variables moved into u.bc */
67099 int alreadyExists;
67100 VdbeCursor *pC;
67101 int res;
 
67102 UnpackedRecord *pIdxKey;
67103 UnpackedRecord r;
67104 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
67105 #endif /* local variables moved into u.bc */
67106
@@ -67125,22 +67201,22 @@
67125 { int i; for(i=0; i<u.bc.r.nField; i++) assert( memIsValid(&u.bc.r.aMem[i]) ); }
67126 #endif
67127 u.bc.r.flags = UNPACKED_PREFIX_MATCH;
67128 u.bc.pIdxKey = &u.bc.r;
67129 }else{
 
 
 
 
67130 assert( pIn3->flags & MEM_Blob );
67131 assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */
67132 u.bc.pIdxKey = sqlite3VdbeRecordUnpack(u.bc.pC->pKeyInfo, pIn3->n, pIn3->z,
67133 u.bc.aTempRec, sizeof(u.bc.aTempRec));
67134 if( u.bc.pIdxKey==0 ){
67135 goto no_mem;
67136 }
67137 u.bc.pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
67138 }
67139 rc = sqlite3BtreeMovetoUnpacked(u.bc.pC->pCursor, u.bc.pIdxKey, 0, 0, &u.bc.res);
67140 if( pOp->p4.i==0 ){
67141 sqlite3VdbeDeleteUnpackedRecord(u.bc.pIdxKey);
67142 }
67143 if( rc!=SQLITE_OK ){
67144 break;
67145 }
67146 u.bc.alreadyExists = (u.bc.res==0);
@@ -69784,10 +69860,11 @@
69784 goto vdbe_error_halt;
69785 }
69786
69787 /************** End of vdbe.c ************************************************/
69788 /************** Begin file vdbeblob.c ****************************************/
 
69789 /*
69790 ** 2007 May 1
69791 **
69792 ** The author disclaims copyright to this source code. In place of
69793 ** a legal notice, here is a blessing:
@@ -70254,10 +70331,11 @@
70254
70255 #endif /* #ifndef SQLITE_OMIT_INCRBLOB */
70256
70257 /************** End of vdbeblob.c ********************************************/
70258 /************** Begin file vdbesort.c ****************************************/
 
70259 /*
70260 ** 2011 July 9
70261 **
70262 ** The author disclaims copyright to this source code. In place of
70263 ** a legal notice, here is a blessing:
@@ -70358,12 +70436,11 @@
70358 sqlite3_file *pTemp1; /* PMA file 1 */
70359 int nPMA; /* Number of PMAs stored in pTemp1 */
70360 SorterRecord *pRecord; /* Head of in-memory record list */
70361 int mnPmaSize; /* Minimum PMA size, in bytes */
70362 int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
70363 char *aSpace; /* Space for UnpackRecord() */
70364 int nSpace; /* Size of aSpace in bytes */
70365 };
70366
70367 /*
70368 ** The following type is an iterator for a PMA. It caches the current key in
70369 ** variables nKey/aKey. If the iterator is at EOF, pFile==0.
@@ -70553,56 +70630,39 @@
70553 ** be less than key2. Even if key2 also contains NULL values.
70554 **
70555 ** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace
70556 ** has been allocated and contains an unpacked record that is used as key2.
70557 */
70558 static int vdbeSorterCompare(
70559 VdbeCursor *pCsr, /* Cursor object (for pKeyInfo) */
70560 int bOmitRowid, /* Ignore rowid field at end of keys */
70561 void *pKey1, int nKey1, /* Left side of comparison */
70562 void *pKey2, int nKey2, /* Right side of comparison */
70563 int *pRes /* OUT: Result of comparison */
70564 ){
70565 KeyInfo *pKeyInfo = pCsr->pKeyInfo;
70566 VdbeSorter *pSorter = pCsr->pSorter;
70567 char *aSpace = pSorter->aSpace;
70568 int nSpace = pSorter->nSpace;
70569 UnpackedRecord *r2;
70570 int i;
70571
70572 if( aSpace==0 ){
70573 nSpace = ROUND8(sizeof(UnpackedRecord))+(pKeyInfo->nField+1)*sizeof(Mem);
70574 aSpace = (char *)sqlite3Malloc(nSpace);
70575 if( aSpace==0 ) return SQLITE_NOMEM;
70576 pSorter->aSpace = aSpace;
70577 pSorter->nSpace = nSpace;
70578 }
70579
70580 if( pKey2 ){
70581 /* This call cannot fail. As the memory is already allocated. */
70582 r2 = sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, aSpace, nSpace);
70583 assert( r2 && (r2->flags & UNPACKED_NEED_FREE)==0 );
70584 assert( r2==(UnpackedRecord*)aSpace );
70585 }else{
70586 r2 = (UnpackedRecord *)aSpace;
70587 assert( !bOmitRowid );
70588 }
70589
70590 if( bOmitRowid ){
70591 for(i=0; i<r2->nField-1; i++){
 
 
70592 if( r2->aMem[i].flags & MEM_Null ){
70593 *pRes = -1;
70594 return SQLITE_OK;
70595 }
70596 }
70597 r2->flags |= UNPACKED_PREFIX_MATCH;
70598 r2->nField--;
70599 assert( r2->nField>0 );
70600 }
70601
70602 *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
70603 return SQLITE_OK;
70604 }
70605
70606 /*
70607 ** This function is called to compare two iterator keys when merging
70608 ** multiple b-tree segments. Parameter iOut is the index of the aTree[]
@@ -70633,19 +70693,14 @@
70633 iRes = i2;
70634 }else if( p2->pFile==0 ){
70635 iRes = i1;
70636 }else{
70637 int res;
70638 int rc;
70639 assert( pCsr->pSorter->aSpace!=0 ); /* allocated in vdbeSorterMerge() */
70640 rc = vdbeSorterCompare(
70641 pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res
70642 );
70643 /* The vdbeSorterCompare() call cannot fail since pCsr->pSorter->aSpace
70644 ** has already been allocated. */
70645 assert( rc==SQLITE_OK );
70646
70647 if( res<=0 ){
70648 iRes = i1;
70649 }else{
70650 iRes = i2;
70651 }
@@ -70660,16 +70715,21 @@
70660 */
70661 SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
70662 int pgsz; /* Page size of main database */
70663 int mxCache; /* Cache size */
70664 VdbeSorter *pSorter; /* The new sorter */
 
70665
70666 assert( pCsr->pKeyInfo && pCsr->pBt==0 );
70667 pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
70668 if( pSorter==0 ){
70669 return SQLITE_NOMEM;
70670 }
 
 
 
 
70671
70672 if( !sqlite3TempInMemory(db) ){
70673 pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
70674 pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
70675 mxCache = db->aDb[0].pSchema->cache_size;
@@ -70707,11 +70767,11 @@
70707 }
70708 if( pSorter->pTemp1 ){
70709 sqlite3OsCloseFree(pSorter->pTemp1);
70710 }
70711 vdbeSorterRecordFree(db, pSorter->pRecord);
70712 sqlite3_free(pSorter->aSpace);
70713 sqlite3DbFree(db, pSorter);
70714 pCsr->pSorter = 0;
70715 }
70716 }
70717
@@ -70728,36 +70788,26 @@
70728 SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE, &dummy
70729 );
70730 }
70731
70732 /*
70733 ** Attemp to merge the two sorted lists p1 and p2 into a single list. If no
70734 ** error occurs set *ppOut to the head of the new list and return SQLITE_OK.
70735 */
70736 static int vdbeSorterMerge(
70737 sqlite3 *db, /* Database handle */
70738 VdbeCursor *pCsr, /* For pKeyInfo */
70739 SorterRecord *p1, /* First list to merge */
70740 SorterRecord *p2, /* Second list to merge */
70741 SorterRecord **ppOut /* OUT: Head of merged list */
70742 ){
70743 int rc = SQLITE_OK;
70744 SorterRecord *pFinal = 0;
70745 SorterRecord **pp = &pFinal;
70746 void *pVal2 = p2 ? p2->pVal : 0;
70747
70748 while( p1 && p2 ){
70749 int res;
70750 rc = vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);
70751 if( rc!=SQLITE_OK ){
70752 *pp = 0;
70753 vdbeSorterRecordFree(db, p1);
70754 vdbeSorterRecordFree(db, p2);
70755 vdbeSorterRecordFree(db, pFinal);
70756 *ppOut = 0;
70757 return rc;
70758 }
70759 if( res<=0 ){
70760 *pp = p1;
70761 pp = &p1->pNext;
70762 p1 = p1->pNext;
70763 pVal2 = 0;
@@ -70768,22 +70818,19 @@
70768 if( p2==0 ) break;
70769 pVal2 = p2->pVal;
70770 }
70771 }
70772 *pp = p1 ? p1 : p2;
70773
70774 *ppOut = pFinal;
70775 return SQLITE_OK;
70776 }
70777
70778 /*
70779 ** Sort the linked list of records headed at pCsr->pRecord. Return SQLITE_OK
70780 ** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error
70781 ** occurs.
70782 */
70783 static int vdbeSorterSort(sqlite3 *db, VdbeCursor *pCsr){
70784 int rc = SQLITE_OK;
70785 int i;
70786 SorterRecord **aSlot;
70787 SorterRecord *p;
70788 VdbeSorter *pSorter = pCsr->pSorter;
70789
@@ -70794,34 +70841,26 @@
70794
70795 p = pSorter->pRecord;
70796 while( p ){
70797 SorterRecord *pNext = p->pNext;
70798 p->pNext = 0;
70799 for(i=0; rc==SQLITE_OK && aSlot[i]; i++){
70800 rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p);
70801 aSlot[i] = 0;
70802 }
70803 if( rc!=SQLITE_OK ){
70804 vdbeSorterRecordFree(db, pNext);
70805 break;
70806 }
70807 aSlot[i] = p;
70808 p = pNext;
70809 }
70810
70811 p = 0;
70812 for(i=0; i<64; i++){
70813 if( rc==SQLITE_OK ){
70814 rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p);
70815 }else{
70816 vdbeSorterRecordFree(db, aSlot[i]);
70817 }
70818 }
70819 pSorter->pRecord = p;
70820
70821 sqlite3_free(aSlot);
70822 return rc;
70823 }
70824
70825
70826 /*
70827 ** Write the current contents of the in-memory linked-list to a PMA. Return
@@ -70843,11 +70882,11 @@
70843 if( pSorter->nInMemory==0 ){
70844 assert( pSorter->pRecord==0 );
70845 return rc;
70846 }
70847
70848 rc = vdbeSorterSort(db, pCsr);
70849
70850 /* If the first temporary PMA file has not been opened, open it now. */
70851 if( rc==SQLITE_OK && pSorter->pTemp1==0 ){
70852 rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);
70853 assert( rc!=SQLITE_OK || pSorter->pTemp1 );
@@ -70990,11 +71029,11 @@
70990 ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly
70991 ** from the in-memory list. */
70992 if( pSorter->nPMA==0 ){
70993 *pbEof = !pSorter->pRecord;
70994 assert( pSorter->aTree==0 );
70995 return vdbeSorterSort(db, pCsr);
70996 }
70997
70998 /* Write the current b-tree to a PMA. Close the b-tree cursor. */
70999 rc = vdbeSorterListToPMA(db, pCsr);
71000 if( rc!=SQLITE_OK ) return rc;
@@ -71160,24 +71199,23 @@
71160 SQLITE_PRIVATE int sqlite3VdbeSorterCompare(
71161 VdbeCursor *pCsr, /* Sorter cursor */
71162 Mem *pVal, /* Value to compare to current sorter key */
71163 int *pRes /* OUT: Result of comparison */
71164 ){
71165 int rc;
71166 VdbeSorter *pSorter = pCsr->pSorter;
71167 void *pKey; int nKey; /* Sorter key to compare pVal with */
71168
71169 pKey = vdbeSorterRowkey(pSorter, &nKey);
71170 rc = vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
71171 assert( rc!=SQLITE_OK || pVal->db->mallocFailed || (*pRes)<=0 );
71172 return rc;
71173 }
71174
71175 #endif /* #ifndef SQLITE_OMIT_MERGE_SORT */
71176
71177 /************** End of vdbesort.c ********************************************/
71178 /************** Begin file journal.c *****************************************/
 
71179 /*
71180 ** 2007 August 22
71181 **
71182 ** The author disclaims copyright to this source code. In place of
71183 ** a legal notice, here is a blessing:
@@ -71414,10 +71452,11 @@
71414 }
71415 #endif
71416
71417 /************** End of journal.c *********************************************/
71418 /************** Begin file memjournal.c **************************************/
 
71419 /*
71420 ** 2008 October 7
71421 **
71422 ** The author disclaims copyright to this source code. In place of
71423 ** a legal notice, here is a blessing:
@@ -71675,10 +71714,11 @@
71675 return sizeof(MemJournal);
71676 }
71677
71678 /************** End of memjournal.c ******************************************/
71679 /************** Begin file walker.c ******************************************/
 
71680 /*
71681 ** 2008 August 16
71682 **
71683 ** The author disclaims copyright to this source code. In place of
71684 ** a legal notice, here is a blessing:
@@ -71813,10 +71853,11 @@
71813 return rc & WRC_Abort;
71814 }
71815
71816 /************** End of walker.c **********************************************/
71817 /************** Begin file resolve.c *****************************************/
 
71818 /*
71819 ** 2008 August 18
71820 **
71821 ** The author disclaims copyright to this source code. In place of
71822 ** a legal notice, here is a blessing:
@@ -73033,10 +73074,11 @@
73033 sqlite3WalkSelect(&w, p);
73034 }
73035
73036 /************** End of resolve.c *********************************************/
73037 /************** Begin file expr.c ********************************************/
 
73038 /*
73039 ** 2001 September 15
73040 **
73041 ** The author disclaims copyright to this source code. In place of
73042 ** a legal notice, here is a blessing:
@@ -76793,10 +76835,11 @@
76793 }
76794 }
76795
76796 /************** End of expr.c ************************************************/
76797 /************** Begin file alter.c *******************************************/
 
76798 /*
76799 ** 2005 February 15
76800 **
76801 ** The author disclaims copyright to this source code. In place of
76802 ** a legal notice, here is a blessing:
@@ -77621,10 +77664,11 @@
77621 }
77622 #endif /* SQLITE_ALTER_TABLE */
77623
77624 /************** End of alter.c ***********************************************/
77625 /************** Begin file analyze.c *****************************************/
 
77626 /*
77627 ** 2005 July 8
77628 **
77629 ** The author disclaims copyright to this source code. In place of
77630 ** a legal notice, here is a blessing:
@@ -78342,10 +78386,11 @@
78342
78343 #endif /* SQLITE_OMIT_ANALYZE */
78344
78345 /************** End of analyze.c *********************************************/
78346 /************** Begin file attach.c ******************************************/
 
78347 /*
78348 ** 2003 April 6
78349 **
78350 ** The author disclaims copyright to this source code. In place of
78351 ** a legal notice, here is a blessing:
@@ -78901,10 +78946,11 @@
78901 }
78902 #endif
78903
78904 /************** End of attach.c **********************************************/
78905 /************** Begin file auth.c ********************************************/
 
78906 /*
78907 ** 2003 January 11
78908 **
78909 ** The author disclaims copyright to this source code. In place of
78910 ** a legal notice, here is a blessing:
@@ -79152,10 +79198,11 @@
79152
79153 #endif /* SQLITE_OMIT_AUTHORIZATION */
79154
79155 /************** End of auth.c ************************************************/
79156 /************** Begin file build.c *******************************************/
 
79157 /*
79158 ** 2001 September 15
79159 **
79160 ** The author disclaims copyright to this source code. In place of
79161 ** a legal notice, here is a blessing:
@@ -82955,10 +83002,11 @@
82955 return pKey;
82956 }
82957
82958 /************** End of build.c ***********************************************/
82959 /************** Begin file callback.c ****************************************/
 
82960 /*
82961 ** 2005 May 23
82962 **
82963 ** The author disclaims copyright to this source code. In place of
82964 ** a legal notice, here is a blessing:
@@ -83414,10 +83462,11 @@
83414 return p;
83415 }
83416
83417 /************** End of callback.c ********************************************/
83418 /************** Begin file delete.c ******************************************/
 
83419 /*
83420 ** 2001 September 15
83421 **
83422 ** The author disclaims copyright to this source code. In place of
83423 ** a legal notice, here is a blessing:
@@ -84068,10 +84117,11 @@
84068 return regBase;
84069 }
84070
84071 /************** End of delete.c **********************************************/
84072 /************** Begin file func.c ********************************************/
 
84073 /*
84074 ** 2002 February 23
84075 **
84076 ** The author disclaims copyright to this source code. In place of
84077 ** a legal notice, here is a blessing:
@@ -85676,10 +85726,11 @@
85676 #endif
85677 }
85678
85679 /************** End of func.c ************************************************/
85680 /************** Begin file fkey.c ********************************************/
 
85681 /*
85682 **
85683 ** The author disclaims copyright to this source code. In place of
85684 ** a legal notice, here is a blessing:
85685 **
@@ -86896,10 +86947,11 @@
86896 }
86897 #endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
86898
86899 /************** End of fkey.c ************************************************/
86900 /************** Begin file insert.c ******************************************/
 
86901 /*
86902 ** 2001 September 15
86903 **
86904 ** The author disclaims copyright to this source code. In place of
86905 ** a legal notice, here is a blessing:
@@ -88741,10 +88793,11 @@
88741 }
88742 #endif /* SQLITE_OMIT_XFER_OPT */
88743
88744 /************** End of insert.c **********************************************/
88745 /************** Begin file legacy.c ******************************************/
 
88746 /*
88747 ** 2001 September 15
88748 **
88749 ** The author disclaims copyright to this source code. In place of
88750 ** a legal notice, here is a blessing:
@@ -88888,10 +88941,11 @@
88888 return rc;
88889 }
88890
88891 /************** End of legacy.c **********************************************/
88892 /************** Begin file loadext.c *****************************************/
 
88893 /*
88894 ** 2006 June 7
88895 **
88896 ** The author disclaims copyright to this source code. In place of
88897 ** a legal notice, here is a blessing:
@@ -88908,10 +88962,11 @@
88908 #ifndef SQLITE_CORE
88909 #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
88910 #endif
88911 /************** Include sqlite3ext.h in the middle of loadext.c **************/
88912 /************** Begin file sqlite3ext.h **************************************/
 
88913 /*
88914 ** 2006 June 7
88915 **
88916 ** The author disclaims copyright to this source code. In place of
88917 ** a legal notice, here is a blessing:
@@ -89336,10 +89391,11 @@
89336
89337 #endif /* _SQLITE3EXT_H_ */
89338
89339 /************** End of sqlite3ext.h ******************************************/
89340 /************** Continuing where we left off in loadext.c ********************/
 
89341 /* #include <string.h> */
89342
89343 #ifndef SQLITE_OMIT_LOAD_EXTENSION
89344
89345 /*
@@ -89975,10 +90031,11 @@
89975 }
89976 }
89977
89978 /************** End of loadext.c *********************************************/
89979 /************** Begin file pragma.c ******************************************/
 
89980 /*
89981 ** 2003 April 6
89982 **
89983 ** The author disclaims copyright to this source code. In place of
89984 ** a legal notice, here is a blessing:
@@ -91503,10 +91560,11 @@
91503
91504 #endif /* SQLITE_OMIT_PRAGMA */
91505
91506 /************** End of pragma.c **********************************************/
91507 /************** Begin file prepare.c *****************************************/
 
91508 /*
91509 ** 2005 May 25
91510 **
91511 ** The author disclaims copyright to this source code. In place of
91512 ** a legal notice, here is a blessing:
@@ -92363,10 +92421,11 @@
92363
92364 #endif /* SQLITE_OMIT_UTF16 */
92365
92366 /************** End of prepare.c *********************************************/
92367 /************** Begin file select.c ******************************************/
 
92368 /*
92369 ** 2001 September 15
92370 **
92371 ** The author disclaims copyright to this source code. In place of
92372 ** a legal notice, here is a blessing:
@@ -96922,10 +96981,11 @@
96922 *****************************************************************************/
96923 #endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
96924
96925 /************** End of select.c **********************************************/
96926 /************** Begin file table.c *******************************************/
 
96927 /*
96928 ** 2001 September 15
96929 **
96930 ** The author disclaims copyright to this source code. In place of
96931 ** a legal notice, here is a blessing:
@@ -97121,10 +97181,11 @@
97121
97122 #endif /* SQLITE_OMIT_GET_TABLE */
97123
97124 /************** End of table.c ***********************************************/
97125 /************** Begin file trigger.c *****************************************/
 
97126 /*
97127 **
97128 ** The author disclaims copyright to this source code. In place of
97129 ** a legal notice, here is a blessing:
97130 **
@@ -98246,10 +98307,11 @@
98246
98247 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
98248
98249 /************** End of trigger.c *********************************************/
98250 /************** Begin file update.c ******************************************/
 
98251 /*
98252 ** 2001 September 15
98253 **
98254 ** The author disclaims copyright to this source code. In place of
98255 ** a legal notice, here is a blessing:
@@ -98918,10 +98980,11 @@
98918 }
98919 #endif /* SQLITE_OMIT_VIRTUALTABLE */
98920
98921 /************** End of update.c **********************************************/
98922 /************** Begin file vacuum.c ******************************************/
 
98923 /*
98924 ** 2003 April 6
98925 **
98926 ** The author disclaims copyright to this source code. In place of
98927 ** a legal notice, here is a blessing:
@@ -99264,10 +99327,11 @@
99264
99265 #endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
99266
99267 /************** End of vacuum.c **********************************************/
99268 /************** Begin file vtab.c ********************************************/
 
99269 /*
99270 ** 2006 June 10
99271 **
99272 ** The author disclaims copyright to this source code. In place of
99273 ** a legal notice, here is a blessing:
@@ -100332,10 +100396,11 @@
100332
100333 #endif /* SQLITE_OMIT_VIRTUALTABLE */
100334
100335 /************** End of vtab.c ************************************************/
100336 /************** Begin file where.c *******************************************/
 
100337 /*
100338 ** 2001 September 15
100339 **
100340 ** The author disclaims copyright to this source code. In place of
100341 ** a legal notice, here is a blessing:
@@ -105518,10 +105583,11 @@
105518 return;
105519 }
105520
105521 /************** End of where.c ***********************************************/
105522 /************** Begin file parse.c *******************************************/
 
105523 /* Driver template for the LEMON parser generator.
105524 ** The author disclaims copyright to this source code.
105525 **
105526 ** This version of "lempar.c" is modified, slightly, for use by SQLite.
105527 ** The only modifications are the addition of a couple of NEVER()
@@ -105530,10 +105596,11 @@
105530 ** specific grammar used by SQLite.
105531 */
105532 /* First off, code is included that follows the "include" declaration
105533 ** in the input grammar file. */
105534 /* #include <stdio.h> */
 
105535
105536
105537 /*
105538 ** Disable all error recovery processing in the parser push-down
105539 ** automaton.
@@ -105577,10 +105644,11 @@
105577 /*
105578 ** An instance of this structure holds the ATTACH key and the key type.
105579 */
105580 struct AttachKey { int type; Token key; };
105581
 
105582
105583 /* This is a utility routine used to set the ExprSpan.zStart and
105584 ** ExprSpan.zEnd values of pOut so that the span covers the complete
105585 ** range of text beginning with pStart and going to the end of pEnd.
105586 */
@@ -105596,10 +105664,11 @@
105596 static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){
105597 pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue);
105598 pOut->zStart = pValue->z;
105599 pOut->zEnd = &pValue->z[pValue->n];
105600 }
 
105601
105602 /* This routine constructs a binary expression node out of two ExprSpan
105603 ** objects and uses the result to populate a new ExprSpan object.
105604 */
105605 static void spanBinaryExpr(
@@ -105611,10 +105680,11 @@
105611 ){
105612 pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);
105613 pOut->zStart = pLeft->zStart;
105614 pOut->zEnd = pRight->zEnd;
105615 }
 
105616
105617 /* Construct an expression node for a unary postfix operator
105618 */
105619 static void spanUnaryPostfix(
105620 ExprSpan *pOut, /* Write the new expression node here */
@@ -105625,10 +105695,11 @@
105625 ){
105626 pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105627 pOut->zStart = pOperand->zStart;
105628 pOut->zEnd = &pPostOp->z[pPostOp->n];
105629 }
 
105630
105631 /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
105632 ** unary TK_ISNULL or TK_NOTNULL expression. */
105633 static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
105634 sqlite3 *db = pParse->db;
@@ -105636,10 +105707,11 @@
105636 pA->op = (u8)op;
105637 sqlite3ExprDelete(db, pA->pRight);
105638 pA->pRight = 0;
105639 }
105640 }
 
105641
105642 /* Construct an expression node for a unary prefix operator
105643 */
105644 static void spanUnaryPrefix(
105645 ExprSpan *pOut, /* Write the new expression node here */
@@ -105650,10 +105722,11 @@
105650 ){
105651 pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105652 pOut->zStart = pPreOp->z;
105653 pOut->zEnd = pOperand->zEnd;
105654 }
 
105655 /* Next is all token values, in a form suitable for use by makeheaders.
105656 ** This section will be null unless lemon is run with the -m switch.
105657 */
105658 /*
105659 ** These constants (all generated automatically by the parser generator)
@@ -106905,17 +106978,21 @@
106905 ** inside the C code.
106906 */
106907 case 160: /* select */
106908 case 194: /* oneselect */
106909 {
 
106910 sqlite3SelectDelete(pParse->db, (yypminor->yy387));
 
106911 }
106912 break;
106913 case 174: /* term */
106914 case 175: /* expr */
106915 {
 
106916 sqlite3ExprDelete(pParse->db, (yypminor->yy118).pExpr);
 
106917 }
106918 break;
106919 case 179: /* idxlist_opt */
106920 case 187: /* idxlist */
106921 case 197: /* selcollist */
@@ -106927,19 +107004,23 @@
106927 case 217: /* setlist */
106928 case 220: /* itemlist */
106929 case 221: /* exprlist */
106930 case 226: /* case_exprlist */
106931 {
 
106932 sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
 
106933 }
106934 break;
106935 case 193: /* fullname */
106936 case 198: /* from */
106937 case 206: /* seltablist */
106938 case 207: /* stl_prefix */
106939 {
 
106940 sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
 
106941 }
106942 break;
106943 case 199: /* where_opt */
106944 case 201: /* having_opt */
106945 case 210: /* on_opt */
@@ -106947,29 +107028,37 @@
106947 case 225: /* case_operand */
106948 case 227: /* case_else */
106949 case 238: /* when_clause */
106950 case 243: /* key_opt */
106951 {
 
106952 sqlite3ExprDelete(pParse->db, (yypminor->yy314));
 
106953 }
106954 break;
106955 case 211: /* using_opt */
106956 case 213: /* inscollist */
106957 case 219: /* inscollist_opt */
106958 {
 
106959 sqlite3IdListDelete(pParse->db, (yypminor->yy384));
 
106960 }
106961 break;
106962 case 234: /* trigger_cmd_list */
106963 case 239: /* trigger_cmd */
106964 {
 
106965 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
 
106966 }
106967 break;
106968 case 236: /* trigger_event */
106969 {
 
106970 sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
 
106971 }
106972 break;
106973 default: break; /* If no destructor action specified: do nothing */
106974 }
106975 }
@@ -107151,14 +107240,16 @@
107151 }
107152 #endif
107153 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
107154 /* Here code is inserted which will execute if the parser
107155 ** stack every overflows */
 
107156
107157 UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */
107158 sqlite3ErrorMsg(pParse, "parser stack overflow");
107159 pParse->parseError = 1;
 
107160 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
107161 }
107162
107163 /*
107164 ** Perform a shift action.
@@ -107595,66 +107686,94 @@
107595 ** { ... } // User supplied code
107596 ** #line <lineno> <thisfile>
107597 ** break;
107598 */
107599 case 5: /* explain ::= */
 
107600 { sqlite3BeginParse(pParse, 0); }
 
107601 break;
107602 case 6: /* explain ::= EXPLAIN */
 
107603 { sqlite3BeginParse(pParse, 1); }
 
107604 break;
107605 case 7: /* explain ::= EXPLAIN QUERY PLAN */
 
107606 { sqlite3BeginParse(pParse, 2); }
 
107607 break;
107608 case 8: /* cmdx ::= cmd */
 
107609 { sqlite3FinishCoding(pParse); }
 
107610 break;
107611 case 9: /* cmd ::= BEGIN transtype trans_opt */
 
107612 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
 
107613 break;
107614 case 13: /* transtype ::= */
 
107615 {yygotominor.yy4 = TK_DEFERRED;}
 
107616 break;
107617 case 14: /* transtype ::= DEFERRED */
107618 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
107619 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
107620 case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
107621 case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
 
107622 {yygotominor.yy4 = yymsp[0].major;}
 
107623 break;
107624 case 17: /* cmd ::= COMMIT trans_opt */
107625 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
 
107626 {sqlite3CommitTransaction(pParse);}
 
107627 break;
107628 case 19: /* cmd ::= ROLLBACK trans_opt */
 
107629 {sqlite3RollbackTransaction(pParse);}
 
107630 break;
107631 case 22: /* cmd ::= SAVEPOINT nm */
 
107632 {
107633 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
107634 }
 
107635 break;
107636 case 23: /* cmd ::= RELEASE savepoint_opt nm */
 
107637 {
107638 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
107639 }
 
107640 break;
107641 case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
 
107642 {
107643 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
107644 }
 
107645 break;
107646 case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
 
107647 {
107648 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
107649 }
 
107650 break;
107651 case 27: /* createkw ::= CREATE */
 
107652 {
107653 pParse->db->lookaside.bEnabled = 0;
107654 yygotominor.yy0 = yymsp[0].minor.yy0;
107655 }
 
107656 break;
107657 case 28: /* ifnotexists ::= */
107658 case 31: /* temp ::= */ yytestcase(yyruleno==31);
107659 case 70: /* autoinc ::= */ yytestcase(yyruleno==70);
107660 case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==83);
@@ -107664,44 +107783,56 @@
107664 case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
107665 case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
107666 case 121: /* distinct ::= */ yytestcase(yyruleno==121);
107667 case 222: /* between_op ::= BETWEEN */ yytestcase(yyruleno==222);
107668 case 225: /* in_op ::= IN */ yytestcase(yyruleno==225);
 
107669 {yygotominor.yy4 = 0;}
 
107670 break;
107671 case 29: /* ifnotexists ::= IF NOT EXISTS */
107672 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
107673 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
107674 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
107675 case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
107676 case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
107677 case 223: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==223);
107678 case 226: /* in_op ::= NOT IN */ yytestcase(yyruleno==226);
 
107679 {yygotominor.yy4 = 1;}
 
107680 break;
107681 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
 
107682 {
107683 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
107684 }
 
107685 break;
107686 case 33: /* create_table_args ::= AS select */
 
107687 {
107688 sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy387);
107689 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
107690 }
 
107691 break;
107692 case 36: /* column ::= columnid type carglist */
 
107693 {
107694 yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
107695 yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n;
107696 }
 
107697 break;
107698 case 37: /* columnid ::= nm */
 
107699 {
107700 sqlite3AddColumn(pParse,&yymsp[0].minor.yy0);
107701 yygotominor.yy0 = yymsp[0].minor.yy0;
107702 }
 
107703 break;
107704 case 38: /* id ::= ID */
107705 case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39);
107706 case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40);
107707 case 41: /* nm ::= id */ yytestcase(yyruleno==41);
@@ -107721,256 +107852,373 @@
107721 case 264: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==264);
107722 case 265: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==265);
107723 case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
107724 case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
107725 case 285: /* trnm ::= nm */ yytestcase(yyruleno==285);
 
107726 {yygotominor.yy0 = yymsp[0].minor.yy0;}
 
107727 break;
107728 case 45: /* type ::= typetoken */
 
107729 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
 
107730 break;
107731 case 47: /* typetoken ::= typename LP signed RP */
 
107732 {
107733 yygotominor.yy0.z = yymsp[-3].minor.yy0.z;
107734 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
107735 }
 
107736 break;
107737 case 48: /* typetoken ::= typename LP signed COMMA signed RP */
 
107738 {
107739 yygotominor.yy0.z = yymsp[-5].minor.yy0.z;
107740 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
107741 }
 
107742 break;
107743 case 50: /* typename ::= typename ids */
 
107744 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
 
107745 break;
107746 case 57: /* ccons ::= DEFAULT term */
107747 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
 
107748 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy118);}
 
107749 break;
107750 case 58: /* ccons ::= DEFAULT LP expr RP */
 
107751 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy118);}
 
107752 break;
107753 case 60: /* ccons ::= DEFAULT MINUS term */
 
107754 {
107755 ExprSpan v;
107756 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy118.pExpr, 0, 0);
107757 v.zStart = yymsp[-1].minor.yy0.z;
107758 v.zEnd = yymsp[0].minor.yy118.zEnd;
107759 sqlite3AddDefaultValue(pParse,&v);
107760 }
 
107761 break;
107762 case 61: /* ccons ::= DEFAULT id */
 
107763 {
107764 ExprSpan v;
107765 spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
107766 sqlite3AddDefaultValue(pParse,&v);
107767 }
 
107768 break;
107769 case 63: /* ccons ::= NOT NULL onconf */
 
107770 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
 
107771 break;
107772 case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
 
107773 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
 
107774 break;
107775 case 65: /* ccons ::= UNIQUE onconf */
 
107776 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0);}
 
107777 break;
107778 case 66: /* ccons ::= CHECK LP expr RP */
 
107779 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy118.pExpr);}
 
107780 break;
107781 case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
 
107782 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
 
107783 break;
107784 case 68: /* ccons ::= defer_subclause */
 
107785 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
 
107786 break;
107787 case 69: /* ccons ::= COLLATE ids */
 
107788 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
 
107789 break;
107790 case 72: /* refargs ::= */
 
107791 { yygotominor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
 
107792 break;
107793 case 73: /* refargs ::= refargs refarg */
 
107794 { yygotominor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
 
107795 break;
107796 case 74: /* refarg ::= MATCH nm */
107797 case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
 
107798 { yygotominor.yy215.value = 0; yygotominor.yy215.mask = 0x000000; }
 
107799 break;
107800 case 76: /* refarg ::= ON DELETE refact */
 
107801 { yygotominor.yy215.value = yymsp[0].minor.yy4; yygotominor.yy215.mask = 0x0000ff; }
 
107802 break;
107803 case 77: /* refarg ::= ON UPDATE refact */
 
107804 { yygotominor.yy215.value = yymsp[0].minor.yy4<<8; yygotominor.yy215.mask = 0x00ff00; }
 
107805 break;
107806 case 78: /* refact ::= SET NULL */
 
107807 { yygotominor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
 
107808 break;
107809 case 79: /* refact ::= SET DEFAULT */
 
107810 { yygotominor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
 
107811 break;
107812 case 80: /* refact ::= CASCADE */
 
107813 { yygotominor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
 
107814 break;
107815 case 81: /* refact ::= RESTRICT */
 
107816 { yygotominor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
 
107817 break;
107818 case 82: /* refact ::= NO ACTION */
 
107819 { yygotominor.yy4 = OE_None; /* EV: R-33326-45252 */}
 
107820 break;
107821 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
107822 case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
107823 case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
107824 case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
 
107825 {yygotominor.yy4 = yymsp[0].minor.yy4;}
 
107826 break;
107827 case 88: /* conslist_opt ::= */
 
107828 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
 
107829 break;
107830 case 89: /* conslist_opt ::= COMMA conslist */
 
107831 {yygotominor.yy0 = yymsp[-1].minor.yy0;}
 
107832 break;
107833 case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
 
107834 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
 
107835 break;
107836 case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
 
107837 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0);}
 
107838 break;
107839 case 96: /* tcons ::= CHECK LP expr RP onconf */
 
107840 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy118.pExpr);}
 
107841 break;
107842 case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
 
107843 {
107844 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
107845 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
107846 }
 
107847 break;
107848 case 100: /* onconf ::= */
 
107849 {yygotominor.yy4 = OE_Default;}
 
107850 break;
107851 case 102: /* orconf ::= */
 
107852 {yygotominor.yy210 = OE_Default;}
 
107853 break;
107854 case 103: /* orconf ::= OR resolvetype */
 
107855 {yygotominor.yy210 = (u8)yymsp[0].minor.yy4;}
 
107856 break;
107857 case 105: /* resolvetype ::= IGNORE */
 
107858 {yygotominor.yy4 = OE_Ignore;}
 
107859 break;
107860 case 106: /* resolvetype ::= REPLACE */
 
107861 {yygotominor.yy4 = OE_Replace;}
 
107862 break;
107863 case 107: /* cmd ::= DROP TABLE ifexists fullname */
 
107864 {
107865 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
107866 }
 
107867 break;
107868 case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
 
107869 {
107870 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy387, yymsp[-6].minor.yy4, yymsp[-4].minor.yy4);
107871 }
 
107872 break;
107873 case 111: /* cmd ::= DROP VIEW ifexists fullname */
 
107874 {
107875 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
107876 }
 
107877 break;
107878 case 112: /* cmd ::= select */
 
107879 {
107880 SelectDest dest = {SRT_Output, 0, 0, 0, 0};
107881 sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
107882 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
107883 }
 
107884 break;
107885 case 113: /* select ::= oneselect */
 
107886 {yygotominor.yy387 = yymsp[0].minor.yy387;}
 
107887 break;
107888 case 114: /* select ::= select multiselect_op oneselect */
 
107889 {
107890 if( yymsp[0].minor.yy387 ){
107891 yymsp[0].minor.yy387->op = (u8)yymsp[-1].minor.yy4;
107892 yymsp[0].minor.yy387->pPrior = yymsp[-2].minor.yy387;
107893 }else{
107894 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy387);
107895 }
107896 yygotominor.yy387 = yymsp[0].minor.yy387;
107897 }
 
107898 break;
107899 case 116: /* multiselect_op ::= UNION ALL */
 
107900 {yygotominor.yy4 = TK_ALL;}
 
107901 break;
107902 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
 
107903 {
107904 yygotominor.yy387 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy259,yymsp[-4].minor.yy314,yymsp[-3].minor.yy322,yymsp[-2].minor.yy314,yymsp[-1].minor.yy322,yymsp[-7].minor.yy4,yymsp[0].minor.yy292.pLimit,yymsp[0].minor.yy292.pOffset);
107905 }
 
107906 break;
107907 case 122: /* sclp ::= selcollist COMMA */
107908 case 247: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==247);
 
107909 {yygotominor.yy322 = yymsp[-1].minor.yy322;}
 
107910 break;
107911 case 123: /* sclp ::= */
107912 case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
107913 case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159);
107914 case 240: /* exprlist ::= */ yytestcase(yyruleno==240);
107915 case 246: /* idxlist_opt ::= */ yytestcase(yyruleno==246);
 
107916 {yygotominor.yy322 = 0;}
 
107917 break;
107918 case 124: /* selcollist ::= sclp expr as */
 
107919 {
107920 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, yymsp[-1].minor.yy118.pExpr);
107921 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[0].minor.yy0, 1);
107922 sqlite3ExprListSetSpan(pParse,yygotominor.yy322,&yymsp[-1].minor.yy118);
107923 }
 
107924 break;
107925 case 125: /* selcollist ::= sclp STAR */
 
107926 {
107927 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
107928 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy322, p);
107929 }
 
107930 break;
107931 case 126: /* selcollist ::= sclp nm DOT STAR */
 
107932 {
107933 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
107934 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
107935 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
107936 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, pDot);
107937 }
 
107938 break;
107939 case 129: /* as ::= */
 
107940 {yygotominor.yy0.n = 0;}
 
107941 break;
107942 case 130: /* from ::= */
 
107943 {yygotominor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy259));}
 
107944 break;
107945 case 131: /* from ::= FROM seltablist */
 
107946 {
107947 yygotominor.yy259 = yymsp[0].minor.yy259;
107948 sqlite3SrcListShiftJoinType(yygotominor.yy259);
107949 }
 
107950 break;
107951 case 132: /* stl_prefix ::= seltablist joinop */
 
107952 {
107953 yygotominor.yy259 = yymsp[-1].minor.yy259;
107954 if( ALWAYS(yygotominor.yy259 && yygotominor.yy259->nSrc>0) ) yygotominor.yy259->a[yygotominor.yy259->nSrc-1].jointype = (u8)yymsp[0].minor.yy4;
107955 }
 
107956 break;
107957 case 133: /* stl_prefix ::= */
 
107958 {yygotominor.yy259 = 0;}
 
107959 break;
107960 case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
 
107961 {
107962 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107963 sqlite3SrcListIndexedBy(pParse, yygotominor.yy259, &yymsp[-2].minor.yy0);
107964 }
 
107965 break;
107966 case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
 
107967 {
107968 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy387,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107969 }
 
107970 break;
107971 case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
 
107972 {
107973 if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
107974 yygotominor.yy259 = yymsp[-4].minor.yy259;
107975 }else{
107976 Select *pSubquery;
@@ -107977,180 +108225,260 @@
107977 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
107978 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,0,0,0);
107979 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
107980 }
107981 }
 
107982 break;
107983 case 137: /* dbnm ::= */
107984 case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
 
107985 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
 
107986 break;
107987 case 139: /* fullname ::= nm dbnm */
 
107988 {yygotominor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
 
107989 break;
107990 case 140: /* joinop ::= COMMA|JOIN */
 
107991 { yygotominor.yy4 = JT_INNER; }
 
107992 break;
107993 case 141: /* joinop ::= JOIN_KW JOIN */
 
107994 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
 
107995 break;
107996 case 142: /* joinop ::= JOIN_KW nm JOIN */
 
107997 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
 
107998 break;
107999 case 143: /* joinop ::= JOIN_KW nm nm JOIN */
 
108000 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
 
108001 break;
108002 case 144: /* on_opt ::= ON expr */
108003 case 155: /* sortitem ::= expr */ yytestcase(yyruleno==155);
108004 case 162: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==162);
108005 case 169: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==169);
108006 case 235: /* case_else ::= ELSE expr */ yytestcase(yyruleno==235);
108007 case 237: /* case_operand ::= expr */ yytestcase(yyruleno==237);
 
108008 {yygotominor.yy314 = yymsp[0].minor.yy118.pExpr;}
 
108009 break;
108010 case 145: /* on_opt ::= */
108011 case 161: /* having_opt ::= */ yytestcase(yyruleno==161);
108012 case 168: /* where_opt ::= */ yytestcase(yyruleno==168);
108013 case 236: /* case_else ::= */ yytestcase(yyruleno==236);
108014 case 238: /* case_operand ::= */ yytestcase(yyruleno==238);
 
108015 {yygotominor.yy314 = 0;}
 
108016 break;
108017 case 148: /* indexed_opt ::= NOT INDEXED */
 
108018 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
 
108019 break;
108020 case 149: /* using_opt ::= USING LP inscollist RP */
108021 case 181: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==181);
 
108022 {yygotominor.yy384 = yymsp[-1].minor.yy384;}
 
108023 break;
108024 case 150: /* using_opt ::= */
108025 case 180: /* inscollist_opt ::= */ yytestcase(yyruleno==180);
 
108026 {yygotominor.yy384 = 0;}
 
108027 break;
108028 case 152: /* orderby_opt ::= ORDER BY sortlist */
108029 case 160: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==160);
108030 case 239: /* exprlist ::= nexprlist */ yytestcase(yyruleno==239);
 
108031 {yygotominor.yy322 = yymsp[0].minor.yy322;}
 
108032 break;
108033 case 153: /* sortlist ::= sortlist COMMA sortitem sortorder */
 
108034 {
108035 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
108036 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108037 }
 
108038 break;
108039 case 154: /* sortlist ::= sortitem sortorder */
 
108040 {
108041 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314);
108042 if( yygotominor.yy322 && ALWAYS(yygotominor.yy322->a) ) yygotominor.yy322->a[0].sortOrder = (u8)yymsp[0].minor.yy4;
108043 }
 
108044 break;
108045 case 156: /* sortorder ::= ASC */
108046 case 158: /* sortorder ::= */ yytestcase(yyruleno==158);
 
108047 {yygotominor.yy4 = SQLITE_SO_ASC;}
 
108048 break;
108049 case 157: /* sortorder ::= DESC */
 
108050 {yygotominor.yy4 = SQLITE_SO_DESC;}
 
108051 break;
108052 case 163: /* limit_opt ::= */
 
108053 {yygotominor.yy292.pLimit = 0; yygotominor.yy292.pOffset = 0;}
 
108054 break;
108055 case 164: /* limit_opt ::= LIMIT expr */
 
108056 {yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr; yygotominor.yy292.pOffset = 0;}
 
108057 break;
108058 case 165: /* limit_opt ::= LIMIT expr OFFSET expr */
 
108059 {yygotominor.yy292.pLimit = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pOffset = yymsp[0].minor.yy118.pExpr;}
 
108060 break;
108061 case 166: /* limit_opt ::= LIMIT expr COMMA expr */
 
108062 {yygotominor.yy292.pOffset = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr;}
 
108063 break;
108064 case 167: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
 
108065 {
108066 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
108067 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314);
108068 }
 
108069 break;
108070 case 170: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
 
108071 {
108072 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
108073 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
108074 sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy210);
108075 }
 
108076 break;
108077 case 171: /* setlist ::= setlist COMMA nm EQ expr */
 
108078 {
108079 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy118.pExpr);
108080 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108081 }
 
108082 break;
108083 case 172: /* setlist ::= nm EQ expr */
 
108084 {
108085 yygotominor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy118.pExpr);
108086 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108087 }
 
108088 break;
108089 case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
 
108090 {sqlite3Insert(pParse, yymsp[-5].minor.yy259, yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy384, yymsp[-7].minor.yy210);}
 
108091 break;
108092 case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
 
108093 {sqlite3Insert(pParse, yymsp[-2].minor.yy259, 0, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy210);}
 
108094 break;
108095 case 175: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
 
108096 {sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy210);}
 
108097 break;
108098 case 176: /* insert_cmd ::= INSERT orconf */
 
108099 {yygotominor.yy210 = yymsp[0].minor.yy210;}
 
108100 break;
108101 case 177: /* insert_cmd ::= REPLACE */
 
108102 {yygotominor.yy210 = OE_Replace;}
 
108103 break;
108104 case 178: /* itemlist ::= itemlist COMMA expr */
108105 case 241: /* nexprlist ::= nexprlist COMMA expr */ yytestcase(yyruleno==241);
 
108106 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy118.pExpr);}
 
108107 break;
108108 case 179: /* itemlist ::= expr */
108109 case 242: /* nexprlist ::= expr */ yytestcase(yyruleno==242);
 
108110 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy118.pExpr);}
 
108111 break;
108112 case 182: /* inscollist ::= inscollist COMMA nm */
 
108113 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
 
108114 break;
108115 case 183: /* inscollist ::= nm */
 
108116 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
 
108117 break;
108118 case 184: /* expr ::= term */
 
108119 {yygotominor.yy118 = yymsp[0].minor.yy118;}
 
108120 break;
108121 case 185: /* expr ::= LP expr RP */
 
108122 {yygotominor.yy118.pExpr = yymsp[-1].minor.yy118.pExpr; spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
 
108123 break;
108124 case 186: /* term ::= NULL */
108125 case 191: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==191);
108126 case 192: /* term ::= STRING */ yytestcase(yyruleno==192);
 
108127 {spanExpr(&yygotominor.yy118, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
 
108128 break;
108129 case 187: /* expr ::= id */
108130 case 188: /* expr ::= JOIN_KW */ yytestcase(yyruleno==188);
 
108131 {spanExpr(&yygotominor.yy118, pParse, TK_ID, &yymsp[0].minor.yy0);}
 
108132 break;
108133 case 189: /* expr ::= nm DOT nm */
 
108134 {
108135 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108136 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108137 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
108138 spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
108139 }
 
108140 break;
108141 case 190: /* expr ::= nm DOT nm DOT nm */
 
108142 {
108143 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
108144 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108145 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108146 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
108147 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
108148 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108149 }
 
108150 break;
108151 case 193: /* expr ::= REGISTER */
 
108152 {
108153 /* When doing a nested parse, one can include terms in an expression
108154 ** that look like this: #1 #2 ... These terms refer to registers
108155 ** in the virtual machine. #N is the N-th register. */
108156 if( pParse->nested==0 ){
@@ -108160,32 +108488,40 @@
108160 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
108161 if( yygotominor.yy118.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy118.pExpr->iTable);
108162 }
108163 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108164 }
 
108165 break;
108166 case 194: /* expr ::= VARIABLE */
 
108167 {
108168 spanExpr(&yygotominor.yy118, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
108169 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy118.pExpr);
108170 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108171 }
 
108172 break;
108173 case 195: /* expr ::= expr COLLATE ids */
 
108174 {
108175 yygotominor.yy118.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy118.pExpr, &yymsp[0].minor.yy0);
108176 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108177 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108178 }
 
108179 break;
108180 case 196: /* expr ::= CAST LP expr AS typetoken RP */
 
108181 {
108182 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy118.pExpr, 0, &yymsp[-1].minor.yy0);
108183 spanSet(&yygotominor.yy118,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
108184 }
 
108185 break;
108186 case 197: /* expr ::= ID LP distinct exprlist RP */
 
108187 {
108188 if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
108189 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
108190 }
108191 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
@@ -108192,47 +108528,59 @@
108192 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108193 if( yymsp[-2].minor.yy4 && yygotominor.yy118.pExpr ){
108194 yygotominor.yy118.pExpr->flags |= EP_Distinct;
108195 }
108196 }
 
108197 break;
108198 case 198: /* expr ::= ID LP STAR RP */
 
108199 {
108200 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
108201 spanSet(&yygotominor.yy118,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
108202 }
 
108203 break;
108204 case 199: /* term ::= CTIME_KW */
 
108205 {
108206 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
108207 ** treated as functions that return constants */
108208 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
108209 if( yygotominor.yy118.pExpr ){
108210 yygotominor.yy118.pExpr->op = TK_CONST_FUNC;
108211 }
108212 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108213 }
 
108214 break;
108215 case 200: /* expr ::= expr AND expr */
108216 case 201: /* expr ::= expr OR expr */ yytestcase(yyruleno==201);
108217 case 202: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==202);
108218 case 203: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==203);
108219 case 204: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==204);
108220 case 205: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==205);
108221 case 206: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==206);
108222 case 207: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==207);
 
108223 {spanBinaryExpr(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);}
 
108224 break;
108225 case 208: /* likeop ::= LIKE_KW */
108226 case 210: /* likeop ::= MATCH */ yytestcase(yyruleno==210);
 
108227 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 0;}
 
108228 break;
108229 case 209: /* likeop ::= NOT LIKE_KW */
108230 case 211: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==211);
 
108231 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 1;}
 
108232 break;
108233 case 212: /* expr ::= expr likeop expr */
 
108234 {
108235 ExprList *pList;
108236 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy118.pExpr);
108237 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy118.pExpr);
108238 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy342.eOperator);
@@ -108239,12 +108587,14 @@
108239 if( yymsp[-1].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108240 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108241 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108242 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108243 }
 
108244 break;
108245 case 213: /* expr ::= expr likeop expr ESCAPE expr */
 
108246 {
108247 ExprList *pList;
108248 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108249 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy118.pExpr);
108250 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
@@ -108252,40 +108602,56 @@
108252 if( yymsp[-3].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108253 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108254 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108255 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108256 }
 
108257 break;
108258 case 214: /* expr ::= expr ISNULL|NOTNULL */
 
108259 {spanUnaryPostfix(&yygotominor.yy118,pParse,yymsp[0].major,&yymsp[-1].minor.yy118,&yymsp[0].minor.yy0);}
 
108260 break;
108261 case 215: /* expr ::= expr NOT NULL */
 
108262 {spanUnaryPostfix(&yygotominor.yy118,pParse,TK_NOTNULL,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy0);}
 
108263 break;
108264 case 216: /* expr ::= expr IS expr */
 
108265 {
108266 spanBinaryExpr(&yygotominor.yy118,pParse,TK_IS,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);
108267 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_ISNULL);
108268 }
 
108269 break;
108270 case 217: /* expr ::= expr IS NOT expr */
 
108271 {
108272 spanBinaryExpr(&yygotominor.yy118,pParse,TK_ISNOT,&yymsp[-3].minor.yy118,&yymsp[0].minor.yy118);
108273 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_NOTNULL);
108274 }
 
108275 break;
108276 case 218: /* expr ::= NOT expr */
108277 case 219: /* expr ::= BITNOT expr */ yytestcase(yyruleno==219);
 
108278 {spanUnaryPrefix(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
 
108279 break;
108280 case 220: /* expr ::= MINUS expr */
 
108281 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UMINUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
 
108282 break;
108283 case 221: /* expr ::= PLUS expr */
 
108284 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UPLUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
 
108285 break;
108286 case 224: /* expr ::= expr between_op expr AND expr */
 
108287 {
108288 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108289 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
108290 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108291 if( yygotominor.yy118.pExpr ){
@@ -108295,12 +108661,14 @@
108295 }
108296 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108297 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108298 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108299 }
 
108300 break;
108301 case 227: /* expr ::= expr in_op LP exprlist RP */
 
108302 {
108303 if( yymsp[-1].minor.yy322==0 ){
108304 /* Expressions of the form
108305 **
108306 ** expr1 IN ()
@@ -108322,12 +108690,14 @@
108322 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108323 }
108324 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108325 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108326 }
 
108327 break;
108328 case 228: /* expr ::= LP select RP */
 
108329 {
108330 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
108331 if( yygotominor.yy118.pExpr ){
108332 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108333 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108336,12 +108706,14 @@
108336 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108337 }
108338 yygotominor.yy118.zStart = yymsp[-2].minor.yy0.z;
108339 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108340 }
 
108341 break;
108342 case 229: /* expr ::= expr in_op LP select RP */
 
108343 {
108344 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108345 if( yygotominor.yy118.pExpr ){
108346 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108347 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108351,12 +108723,14 @@
108351 }
108352 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108353 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108354 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108355 }
 
108356 break;
108357 case 230: /* expr ::= expr in_op nm dbnm */
 
108358 {
108359 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
108360 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy118.pExpr, 0, 0);
108361 if( yygotominor.yy118.pExpr ){
108362 yygotominor.yy118.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
@@ -108367,12 +108741,14 @@
108367 }
108368 if( yymsp[-2].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108369 yygotominor.yy118.zStart = yymsp[-3].minor.yy118.zStart;
108370 yygotominor.yy118.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
108371 }
 
108372 break;
108373 case 231: /* expr ::= EXISTS LP select RP */
 
108374 {
108375 Expr *p = yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
108376 if( p ){
108377 p->x.pSelect = yymsp[-1].minor.yy387;
108378 ExprSetProperty(p, EP_xIsSelect);
@@ -108381,12 +108757,14 @@
108381 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108382 }
108383 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
108384 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108385 }
 
108386 break;
108387 case 232: /* expr ::= CASE case_operand case_exprlist case_else END */
 
108388 {
108389 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, 0);
108390 if( yygotominor.yy118.pExpr ){
108391 yygotominor.yy118.pExpr->x.pList = yymsp[-2].minor.yy322;
108392 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
@@ -108394,38 +108772,50 @@
108394 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
108395 }
108396 yygotominor.yy118.zStart = yymsp[-4].minor.yy0.z;
108397 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108398 }
 
108399 break;
108400 case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
 
108401 {
108402 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy118.pExpr);
108403 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108404 }
 
108405 break;
108406 case 234: /* case_exprlist ::= WHEN expr THEN expr */
 
108407 {
108408 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108409 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108410 }
 
108411 break;
108412 case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
 
108413 {
108414 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
108415 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy322, yymsp[-9].minor.yy4,
108416 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy4);
108417 }
 
108418 break;
108419 case 244: /* uniqueflag ::= UNIQUE */
108420 case 298: /* raisetype ::= ABORT */ yytestcase(yyruleno==298);
 
108421 {yygotominor.yy4 = OE_Abort;}
 
108422 break;
108423 case 245: /* uniqueflag ::= */
 
108424 {yygotominor.yy4 = OE_None;}
 
108425 break;
108426 case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */
 
108427 {
108428 Expr *p = 0;
108429 if( yymsp[-1].minor.yy0.n>0 ){
108430 p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
108431 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108433,12 +108823,14 @@
108433 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, p);
108434 sqlite3ExprListSetName(pParse,yygotominor.yy322,&yymsp[-2].minor.yy0,1);
108435 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108436 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108437 }
 
108438 break;
108439 case 249: /* idxlist ::= nm collate sortorder */
 
108440 {
108441 Expr *p = 0;
108442 if( yymsp[-1].minor.yy0.n>0 ){
108443 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
108444 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108446,214 +108838,307 @@
108446 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, p);
108447 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108448 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108449 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108450 }
 
108451 break;
108452 case 250: /* collate ::= */
 
108453 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
 
108454 break;
108455 case 252: /* cmd ::= DROP INDEX ifexists fullname */
 
108456 {sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
 
108457 break;
108458 case 253: /* cmd ::= VACUUM */
108459 case 254: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==254);
 
108460 {sqlite3Vacuum(pParse);}
 
108461 break;
108462 case 255: /* cmd ::= PRAGMA nm dbnm */
 
108463 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
 
108464 break;
108465 case 256: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
 
108466 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
 
108467 break;
108468 case 257: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
 
108469 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
 
108470 break;
108471 case 258: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
 
108472 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
 
108473 break;
108474 case 259: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
 
108475 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
 
108476 break;
108477 case 270: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
 
108478 {
108479 Token all;
108480 all.z = yymsp[-3].minor.yy0.z;
108481 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
108482 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
108483 }
 
108484 break;
108485 case 271: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
 
108486 {
108487 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy4, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy259, yymsp[0].minor.yy314, yymsp[-10].minor.yy4, yymsp[-8].minor.yy4);
108488 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
108489 }
 
108490 break;
108491 case 272: /* trigger_time ::= BEFORE */
108492 case 275: /* trigger_time ::= */ yytestcase(yyruleno==275);
 
108493 { yygotominor.yy4 = TK_BEFORE; }
 
108494 break;
108495 case 273: /* trigger_time ::= AFTER */
 
108496 { yygotominor.yy4 = TK_AFTER; }
 
108497 break;
108498 case 274: /* trigger_time ::= INSTEAD OF */
 
108499 { yygotominor.yy4 = TK_INSTEAD;}
 
108500 break;
108501 case 276: /* trigger_event ::= DELETE|INSERT */
108502 case 277: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==277);
 
108503 {yygotominor.yy90.a = yymsp[0].major; yygotominor.yy90.b = 0;}
 
108504 break;
108505 case 278: /* trigger_event ::= UPDATE OF inscollist */
 
108506 {yygotominor.yy90.a = TK_UPDATE; yygotominor.yy90.b = yymsp[0].minor.yy384;}
 
108507 break;
108508 case 281: /* when_clause ::= */
108509 case 303: /* key_opt ::= */ yytestcase(yyruleno==303);
 
108510 { yygotominor.yy314 = 0; }
 
108511 break;
108512 case 282: /* when_clause ::= WHEN expr */
108513 case 304: /* key_opt ::= KEY expr */ yytestcase(yyruleno==304);
 
108514 { yygotominor.yy314 = yymsp[0].minor.yy118.pExpr; }
 
108515 break;
108516 case 283: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
 
108517 {
108518 assert( yymsp[-2].minor.yy203!=0 );
108519 yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
108520 yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
108521 yygotominor.yy203 = yymsp[-2].minor.yy203;
108522 }
 
108523 break;
108524 case 284: /* trigger_cmd_list ::= trigger_cmd SEMI */
 
108525 {
108526 assert( yymsp[-1].minor.yy203!=0 );
108527 yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
108528 yygotominor.yy203 = yymsp[-1].minor.yy203;
108529 }
 
108530 break;
108531 case 286: /* trnm ::= nm DOT nm */
 
108532 {
108533 yygotominor.yy0 = yymsp[0].minor.yy0;
108534 sqlite3ErrorMsg(pParse,
108535 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
108536 "statements within triggers");
108537 }
 
108538 break;
108539 case 288: /* tridxby ::= INDEXED BY nm */
 
108540 {
108541 sqlite3ErrorMsg(pParse,
108542 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
108543 "within triggers");
108544 }
 
108545 break;
108546 case 289: /* tridxby ::= NOT INDEXED */
 
108547 {
108548 sqlite3ErrorMsg(pParse,
108549 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
108550 "within triggers");
108551 }
 
108552 break;
108553 case 290: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
 
108554 { yygotominor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy314, yymsp[-5].minor.yy210); }
 
108555 break;
108556 case 291: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP */
 
108557 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy384, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy210);}
 
108558 break;
108559 case 292: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
 
108560 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy384, 0, yymsp[0].minor.yy387, yymsp[-4].minor.yy210);}
 
108561 break;
108562 case 293: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
 
108563 {yygotominor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy314);}
 
108564 break;
108565 case 294: /* trigger_cmd ::= select */
 
108566 {yygotominor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy387); }
 
108567 break;
108568 case 295: /* expr ::= RAISE LP IGNORE RP */
 
108569 {
108570 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
108571 if( yygotominor.yy118.pExpr ){
108572 yygotominor.yy118.pExpr->affinity = OE_Ignore;
108573 }
108574 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
108575 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108576 }
 
108577 break;
108578 case 296: /* expr ::= RAISE LP raisetype COMMA nm RP */
 
108579 {
108580 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
108581 if( yygotominor.yy118.pExpr ) {
108582 yygotominor.yy118.pExpr->affinity = (char)yymsp[-3].minor.yy4;
108583 }
108584 yygotominor.yy118.zStart = yymsp[-5].minor.yy0.z;
108585 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108586 }
 
108587 break;
108588 case 297: /* raisetype ::= ROLLBACK */
 
108589 {yygotominor.yy4 = OE_Rollback;}
 
108590 break;
108591 case 299: /* raisetype ::= FAIL */
 
108592 {yygotominor.yy4 = OE_Fail;}
 
108593 break;
108594 case 300: /* cmd ::= DROP TRIGGER ifexists fullname */
 
108595 {
108596 sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
108597 }
 
108598 break;
108599 case 301: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
 
108600 {
108601 sqlite3Attach(pParse, yymsp[-3].minor.yy118.pExpr, yymsp[-1].minor.yy118.pExpr, yymsp[0].minor.yy314);
108602 }
 
108603 break;
108604 case 302: /* cmd ::= DETACH database_kw_opt expr */
 
108605 {
108606 sqlite3Detach(pParse, yymsp[0].minor.yy118.pExpr);
108607 }
 
108608 break;
108609 case 307: /* cmd ::= REINDEX */
 
108610 {sqlite3Reindex(pParse, 0, 0);}
 
108611 break;
108612 case 308: /* cmd ::= REINDEX nm dbnm */
 
108613 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
 
108614 break;
108615 case 309: /* cmd ::= ANALYZE */
 
108616 {sqlite3Analyze(pParse, 0, 0);}
 
108617 break;
108618 case 310: /* cmd ::= ANALYZE nm dbnm */
 
108619 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
 
108620 break;
108621 case 311: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
 
108622 {
108623 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
108624 }
 
108625 break;
108626 case 312: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
 
108627 {
108628 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
108629 }
 
108630 break;
108631 case 313: /* add_column_fullname ::= fullname */
 
108632 {
108633 pParse->db->lookaside.bEnabled = 0;
108634 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
108635 }
 
108636 break;
108637 case 316: /* cmd ::= create_vtab */
 
108638 {sqlite3VtabFinishParse(pParse,0);}
 
108639 break;
108640 case 317: /* cmd ::= create_vtab LP vtabarglist RP */
 
108641 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
 
108642 break;
108643 case 318: /* create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm */
 
108644 {
108645 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
108646 }
 
108647 break;
108648 case 321: /* vtabarg ::= */
 
108649 {sqlite3VtabArgInit(pParse);}
 
108650 break;
108651 case 323: /* vtabargtoken ::= ANY */
108652 case 324: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==324);
108653 case 325: /* lp ::= LP */ yytestcase(yyruleno==325);
 
108654 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
 
108655 break;
108656 default:
108657 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
108658 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
108659 /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2);
@@ -108751,15 +109236,17 @@
108751 int yymajor, /* The major type of the error token */
108752 YYMINORTYPE yyminor /* The minor type of the error token */
108753 ){
108754 sqlite3ParserARG_FETCH;
108755 #define TOKEN (yyminor.yy0)
 
108756
108757 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
108758 assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
108759 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
108760 pParse->parseError = 1;
 
108761 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
108762 }
108763
108764 /*
108765 ** The following is executed when the parser accepts
@@ -108949,10 +109436,11 @@
108949 return;
108950 }
108951
108952 /************** End of parse.c ***********************************************/
108953 /************** Begin file tokenize.c ****************************************/
 
108954 /*
108955 ** 2001 September 15
108956 **
108957 ** The author disclaims copyright to this source code. In place of
108958 ** a legal notice, here is a blessing:
@@ -109014,10 +109502,11 @@
109014 ** named keywordhash.h and then included into this source file by
109015 ** the #include below.
109016 */
109017 /************** Include keywordhash.h in the middle of tokenize.c ************/
109018 /************** Begin file keywordhash.h *************************************/
 
109019 /***** This file contains automatically generated code ******
109020 **
109021 ** The code in this file has been automatically generated by
109022 **
109023 ** sqlite/tool/mkkeywordhash.c
@@ -109287,10 +109776,11 @@
109287 }
109288 #define SQLITE_N_KEYWORD 121
109289
109290 /************** End of keywordhash.h *****************************************/
109291 /************** Continuing where we left off in tokenize.c *******************/
 
109292
109293
109294 /*
109295 ** If X is a character that can be used in an identifier then
109296 ** IdChar(X) will be true. Otherwise it is false.
@@ -109751,10 +110241,11 @@
109751 return nErr;
109752 }
109753
109754 /************** End of tokenize.c ********************************************/
109755 /************** Begin file complete.c ****************************************/
 
109756 /*
109757 ** 2001 September 15
109758 **
109759 ** The author disclaims copyright to this source code. In place of
109760 ** a legal notice, here is a blessing:
@@ -110036,10 +110527,11 @@
110036 #endif /* SQLITE_OMIT_UTF16 */
110037 #endif /* SQLITE_OMIT_COMPLETE */
110038
110039 /************** End of complete.c ********************************************/
110040 /************** Begin file main.c ********************************************/
 
110041 /*
110042 ** 2001 September 15
110043 **
110044 ** The author disclaims copyright to this source code. In place of
110045 ** a legal notice, here is a blessing:
@@ -110056,10 +110548,11 @@
110056 */
110057
110058 #ifdef SQLITE_ENABLE_FTS3
110059 /************** Include fts3.h in the middle of main.c ***********************/
110060 /************** Begin file fts3.h ********************************************/
 
110061 /*
110062 ** 2006 Oct 10
110063 **
110064 ** The author disclaims copyright to this source code. In place of
110065 ** a legal notice, here is a blessing:
@@ -110084,14 +110577,16 @@
110084 } /* extern "C" */
110085 #endif /* __cplusplus */
110086
110087 /************** End of fts3.h ************************************************/
110088 /************** Continuing where we left off in main.c ***********************/
 
110089 #endif
110090 #ifdef SQLITE_ENABLE_RTREE
110091 /************** Include rtree.h in the middle of main.c **********************/
110092 /************** Begin file rtree.h *******************************************/
 
110093 /*
110094 ** 2008 May 26
110095 **
110096 ** The author disclaims copyright to this source code. In place of
110097 ** a legal notice, here is a blessing:
@@ -110116,14 +110611,16 @@
110116 } /* extern "C" */
110117 #endif /* __cplusplus */
110118
110119 /************** End of rtree.h ***********************************************/
110120 /************** Continuing where we left off in main.c ***********************/
 
110121 #endif
110122 #ifdef SQLITE_ENABLE_ICU
110123 /************** Include sqliteicu.h in the middle of main.c ******************/
110124 /************** Begin file sqliteicu.h ***************************************/
 
110125 /*
110126 ** 2008 May 26
110127 **
110128 ** The author disclaims copyright to this source code. In place of
110129 ** a legal notice, here is a blessing:
@@ -110149,10 +110646,11 @@
110149 #endif /* __cplusplus */
110150
110151
110152 /************** End of sqliteicu.h *******************************************/
110153 /************** Continuing where we left off in main.c ***********************/
 
110154 #endif
110155
110156 #ifndef SQLITE_AMALGAMATION
110157 /* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
110158 ** contains the text of SQLITE_VERSION macro.
@@ -113079,10 +113577,11 @@
113079 return 0;
113080 }
113081
113082 /************** End of main.c ************************************************/
113083 /************** Begin file notify.c ******************************************/
 
113084 /*
113085 ** 2009 March 3
113086 **
113087 ** The author disclaims copyright to this source code. In place of
113088 ** a legal notice, here is a blessing:
@@ -113412,10 +113911,11 @@
113412 }
113413 #endif
113414
113415 /************** End of notify.c **********************************************/
113416 /************** Begin file fts3.c ********************************************/
 
113417 /*
113418 ** 2006 Oct 10
113419 **
113420 ** The author disclaims copyright to this source code. In place of
113421 ** a legal notice, here is a blessing:
@@ -113708,10 +114208,11 @@
113708 ** into a single segment.
113709 */
113710
113711 /************** Include fts3Int.h in the middle of fts3.c ********************/
113712 /************** Begin file fts3Int.h *****************************************/
 
113713 /*
113714 ** 2009 Nov 12
113715 **
113716 ** The author disclaims copyright to this source code. In place of
113717 ** a legal notice, here is a blessing:
@@ -113746,10 +114247,11 @@
113746 SQLITE_API extern const sqlite3_api_routines *sqlite3_api;
113747 #endif
113748
113749 /************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
113750 /************** Begin file fts3_tokenizer.h **********************************/
 
113751 /*
113752 ** 2006 July 10
113753 **
113754 ** The author disclaims copyright to this source code.
113755 **
@@ -113900,12 +114402,14 @@
113900
113901 #endif /* _FTS3_TOKENIZER_H_ */
113902
113903 /************** End of fts3_tokenizer.h **************************************/
113904 /************** Continuing where we left off in fts3Int.h ********************/
 
113905 /************** Include fts3_hash.h in the middle of fts3Int.h ***************/
113906 /************** Begin file fts3_hash.h ***************************************/
 
113907 /*
113908 ** 2001 September 22
113909 **
113910 ** The author disclaims copyright to this source code. In place of
113911 ** a legal notice, here is a blessing:
@@ -114017,10 +114521,11 @@
114017
114018 #endif /* _FTS3_HASH_H_ */
114019
114020 /************** End of fts3_hash.h *******************************************/
114021 /************** Continuing where we left off in fts3Int.h ********************/
 
114022
114023 /*
114024 ** This constant controls how often segments are merged. Once there are
114025 ** FTS3_MERGE_COUNT segments of level N, they are merged into a single
114026 ** segment of level N+1.
@@ -114493,10 +114998,11 @@
114493 #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
114494 #endif /* _FTSINT_H */
114495
114496 /************** End of fts3Int.h *********************************************/
114497 /************** Continuing where we left off in fts3.c ***********************/
 
114498 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
114499
114500 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
114501 # define SQLITE_CORE 1
114502 #endif
@@ -116264,11 +116770,41 @@
116264 char *aOut;
116265 int bFirstOut = 0;
116266
116267 *paOut = 0;
116268 *pnOut = 0;
116269 aOut = sqlite3_malloc(n1+n2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116270 if( !aOut ) return SQLITE_NOMEM;
116271
116272 p = aOut;
116273 fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);
116274 fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);
@@ -116291,10 +116827,11 @@
116291 }
116292 }
116293
116294 *paOut = aOut;
116295 *pnOut = (p-aOut);
 
116296 return SQLITE_OK;
116297 }
116298
116299 /*
116300 ** This function does a "phrase" merge of two doclists. In a phrase merge,
@@ -119011,10 +119548,11 @@
119011
119012 #endif
119013
119014 /************** End of fts3.c ************************************************/
119015 /************** Begin file fts3_aux.c ****************************************/
 
119016 /*
119017 ** 2011 Jan 27
119018 **
119019 ** The author disclaims copyright to this source code. In place of
119020 ** a legal notice, here is a blessing:
@@ -119487,10 +120025,11 @@
119487
119488 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
119489
119490 /************** End of fts3_aux.c ********************************************/
119491 /************** Begin file fts3_expr.c ***************************************/
 
119492 /*
119493 ** 2008 Nov 28
119494 **
119495 ** The author disclaims copyright to this source code. In place of
119496 ** a legal notice, here is a blessing:
@@ -120453,10 +120992,11 @@
120453 #endif
120454 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120455
120456 /************** End of fts3_expr.c *******************************************/
120457 /************** Begin file fts3_hash.c ***************************************/
 
120458 /*
120459 ** 2001 September 22
120460 **
120461 ** The author disclaims copyright to this source code. In place of
120462 ** a legal notice, here is a blessing:
@@ -120837,10 +121377,11 @@
120837
120838 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120839
120840 /************** End of fts3_hash.c *******************************************/
120841 /************** Begin file fts3_porter.c *************************************/
 
120842 /*
120843 ** 2006 September 30
120844 **
120845 ** The author disclaims copyright to this source code. In place of
120846 ** a legal notice, here is a blessing:
@@ -121483,10 +122024,11 @@
121483
121484 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
121485
121486 /************** End of fts3_porter.c *****************************************/
121487 /************** Begin file fts3_tokenizer.c **********************************/
 
121488 /*
121489 ** 2007 June 22
121490 **
121491 ** The author disclaims copyright to this source code. In place of
121492 ** a legal notice, here is a blessing:
@@ -121974,10 +122516,11 @@
121974
121975 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
121976
121977 /************** End of fts3_tokenizer.c **************************************/
121978 /************** Begin file fts3_tokenizer1.c *********************************/
 
121979 /*
121980 ** 2006 Oct 10
121981 **
121982 ** The author disclaims copyright to this source code. In place of
121983 ** a legal notice, here is a blessing:
@@ -122208,10 +122751,11 @@
122208
122209 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
122210
122211 /************** End of fts3_tokenizer1.c *************************************/
122212 /************** Begin file fts3_write.c **************************************/
 
122213 /*
122214 ** 2009 Oct 23
122215 **
122216 ** The author disclaims copyright to this source code. In place of
122217 ** a legal notice, here is a blessing:
@@ -125478,10 +126022,11 @@
125478
125479 #endif
125480
125481 /************** End of fts3_write.c ******************************************/
125482 /************** Begin file fts3_snippet.c ************************************/
 
125483 /*
125484 ** 2009 Oct 23
125485 **
125486 ** The author disclaims copyright to this source code. In place of
125487 ** a legal notice, here is a blessing:
@@ -126979,10 +127524,11 @@
126979
126980 #endif
126981
126982 /************** End of fts3_snippet.c ****************************************/
126983 /************** Begin file rtree.c *******************************************/
 
126984 /*
126985 ** 2001 September 15
126986 **
126987 ** The author disclaims copyright to this source code. In place of
126988 ** a legal notice, here is a blessing:
@@ -130260,10 +130806,11 @@
130260
130261 #endif
130262
130263 /************** End of rtree.c ***********************************************/
130264 /************** Begin file icu.c *********************************************/
 
130265 /*
130266 ** 2007 May 6
130267 **
130268 ** The author disclaims copyright to this source code. In place of
130269 ** a legal notice, here is a blessing:
@@ -130762,10 +131309,11 @@
130762
130763 #endif
130764
130765 /************** End of icu.c *************************************************/
130766 /************** Begin file fts3_icu.c ****************************************/
 
130767 /*
130768 ** 2007 June 22
130769 **
130770 ** The author disclaims copyright to this source code. In place of
130771 ** a legal notice, here is a blessing:
130772
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -24,10 +24,11 @@
24 #endif
25 #ifndef SQLITE_API
26 # define SQLITE_API
27 #endif
28 /************** Begin file sqliteInt.h ***************************************/
29 #line 1 "tsrc/sqliteInt.h"
30 /*
31 ** 2001 September 15
32 **
33 ** The author disclaims copyright to this source code. In place of
34 ** a legal notice, here is a blessing:
@@ -78,10 +79,11 @@
79 #include "config.h"
80 #endif
81
82 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
83 /************** Begin file sqliteLimit.h *************************************/
84 #line 1 "tsrc/sqliteLimit.h"
85 /*
86 ** 2007 May 7
87 **
88 ** The author disclaims copyright to this source code. In place of
89 ** a legal notice, here is a blessing:
@@ -289,10 +291,11 @@
291 # define SQLITE_MAX_TRIGGER_DEPTH 1000
292 #endif
293
294 /************** End of sqliteLimit.h *****************************************/
295 /************** Continuing where we left off in sqliteInt.h ******************/
296 #line 54 "tsrc/sqliteInt.h"
297
298 /* Disable nuisance warnings on Borland compilers */
299 #if defined(__BORLANDC__)
300 #pragma warn -rch /* unreachable code */
301 #pragma warn -ccc /* Condition is always true or false */
@@ -545,10 +548,11 @@
548 # define unlikely(X) !!(X)
549 #endif
550
551 /************** Include sqlite3.h in the middle of sqliteInt.h ***************/
552 /************** Begin file sqlite3.h *****************************************/
553 #line 1 "tsrc/sqlite3.h"
554 /*
555 ** 2001 September 15
556 **
557 ** The author disclaims copyright to this source code. In place of
558 ** a legal notice, here is a blessing:
@@ -656,11 +660,11 @@
660 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
661 ** [sqlite_version()] and [sqlite_source_id()].
662 */
663 #define SQLITE_VERSION "3.7.8"
664 #define SQLITE_VERSION_NUMBER 3007008
665 #define SQLITE_SOURCE_ID "2011-09-14 13:41:40 a1f3aeeb0988c848d40ce8f6da6e902935a997e2"
666
667 /*
668 ** CAPI3REF: Run-Time Library Version Numbers
669 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
670 **
@@ -7305,12 +7309,14 @@
7309 #endif /* ifndef _SQLITE3RTREE_H_ */
7310
7311
7312 /************** End of sqlite3.h *********************************************/
7313 /************** Continuing where we left off in sqliteInt.h ******************/
7314 #line 309 "tsrc/sqliteInt.h"
7315 /************** Include hash.h in the middle of sqliteInt.h ******************/
7316 /************** Begin file hash.h ********************************************/
7317 #line 1 "tsrc/hash.h"
7318 /*
7319 ** 2001 September 22
7320 **
7321 ** The author disclaims copyright to this source code. In place of
7322 ** a legal notice, here is a blessing:
@@ -7406,12 +7412,14 @@
7412
7413 #endif /* _SQLITE_HASH_H_ */
7414
7415 /************** End of hash.h ************************************************/
7416 /************** Continuing where we left off in sqliteInt.h ******************/
7417 #line 310 "tsrc/sqliteInt.h"
7418 /************** Include parse.h in the middle of sqliteInt.h *****************/
7419 /************** Begin file parse.h *******************************************/
7420 #line 1 "tsrc/parse.h"
7421 #define TK_SEMI 1
7422 #define TK_EXPLAIN 2
7423 #define TK_QUERY 3
7424 #define TK_PLAN 4
7425 #define TK_BEGIN 5
@@ -7568,10 +7576,11 @@
7576 #define TK_UMINUS 156
7577 #define TK_UPLUS 157
7578
7579 /************** End of parse.h ***********************************************/
7580 /************** Continuing where we left off in sqliteInt.h ******************/
7581 #line 311 "tsrc/sqliteInt.h"
7582 #include <stdio.h>
7583 #include <stdlib.h>
7584 #include <string.h>
7585 #include <assert.h>
7586 #include <stddef.h>
@@ -7911,10 +7920,11 @@
7920 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
7921 ** pointer types (i.e. FuncDef) defined above.
7922 */
7923 /************** Include btree.h in the middle of sqliteInt.h *****************/
7924 /************** Begin file btree.h *******************************************/
7925 #line 1 "tsrc/btree.h"
7926 /*
7927 ** 2001 September 15
7928 **
7929 ** The author disclaims copyright to this source code. In place of
7930 ** a legal notice, here is a blessing:
@@ -8155,12 +8165,14 @@
8165
8166 #endif /* _BTREE_H_ */
8167
8168 /************** End of btree.h ***********************************************/
8169 /************** Continuing where we left off in sqliteInt.h ******************/
8170 #line 653 "tsrc/sqliteInt.h"
8171 /************** Include vdbe.h in the middle of sqliteInt.h ******************/
8172 /************** Begin file vdbe.h ********************************************/
8173 #line 1 "tsrc/vdbe.h"
8174 /*
8175 ** 2001 September 15
8176 **
8177 ** The author disclaims copyright to this source code. In place of
8178 ** a legal notice, here is a blessing:
@@ -8321,10 +8333,11 @@
8333 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
8334 ** header file that defines a number for each opcode used by the VDBE.
8335 */
8336 /************** Include opcodes.h in the middle of vdbe.h ********************/
8337 /************** Begin file opcodes.h *****************************************/
8338 #line 1 "tsrc/opcodes.h"
8339 /* Automatically generated. Do not edit */
8340 /* See the mkopcodeh.awk script for details */
8341 #define OP_Goto 1
8342 #define OP_Gosub 2
8343 #define OP_Return 3
@@ -8508,10 +8521,11 @@
8521 /* 136 */ 0x00, 0x01, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04,\
8522 /* 144 */ 0x04, 0x04, 0x02, 0x00, 0x00, 0x00,}
8523
8524 /************** End of opcodes.h *********************************************/
8525 /************** Continuing where we left off in vdbe.h ***********************/
8526 #line 164 "tsrc/vdbe.h"
8527
8528 /*
8529 ** Prototypes for the VDBE interface. See comments on the implementation
8530 ** for a description of what each of these routines does.
8531 */
@@ -8559,13 +8573,13 @@
8573 SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);
8574 #ifndef SQLITE_OMIT_TRACE
8575 SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
8576 #endif
8577
8578 SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
 
8579 SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
8580 SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);
8581
8582 #ifndef SQLITE_OMIT_TRIGGER
8583 SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
8584 #endif
8585
@@ -8582,12 +8596,14 @@
8596
8597 #endif
8598
8599 /************** End of vdbe.h ************************************************/
8600 /************** Continuing where we left off in sqliteInt.h ******************/
8601 #line 654 "tsrc/sqliteInt.h"
8602 /************** Include pager.h in the middle of sqliteInt.h *****************/
8603 /************** Begin file pager.h *******************************************/
8604 #line 1 "tsrc/pager.h"
8605 /*
8606 ** 2001 September 15
8607 **
8608 ** The author disclaims copyright to this source code. In place of
8609 ** a legal notice, here is a blessing:
@@ -8769,12 +8785,14 @@
8785
8786 #endif /* _PAGER_H_ */
8787
8788 /************** End of pager.h ***********************************************/
8789 /************** Continuing where we left off in sqliteInt.h ******************/
8790 #line 655 "tsrc/sqliteInt.h"
8791 /************** Include pcache.h in the middle of sqliteInt.h ****************/
8792 /************** Begin file pcache.h ******************************************/
8793 #line 1 "tsrc/pcache.h"
8794 /*
8795 ** 2008 August 05
8796 **
8797 ** The author disclaims copyright to this source code. In place of
8798 ** a legal notice, here is a blessing:
@@ -8929,13 +8947,15 @@
8947
8948 #endif /* _PCACHE_H_ */
8949
8950 /************** End of pcache.h **********************************************/
8951 /************** Continuing where we left off in sqliteInt.h ******************/
8952 #line 656 "tsrc/sqliteInt.h"
8953
8954 /************** Include os.h in the middle of sqliteInt.h ********************/
8955 /************** Begin file os.h **********************************************/
8956 #line 1 "tsrc/os.h"
8957 /*
8958 ** 2001 September 16
8959 **
8960 ** The author disclaims copyright to this source code. In place of
8961 ** a legal notice, here is a blessing:
@@ -9214,12 +9234,14 @@
9234
9235 #endif /* _SQLITE_OS_H_ */
9236
9237 /************** End of os.h **************************************************/
9238 /************** Continuing where we left off in sqliteInt.h ******************/
9239 #line 658 "tsrc/sqliteInt.h"
9240 /************** Include mutex.h in the middle of sqliteInt.h *****************/
9241 /************** Begin file mutex.h *******************************************/
9242 #line 1 "tsrc/mutex.h"
9243 /*
9244 ** 2007 August 28
9245 **
9246 ** The author disclaims copyright to this source code. In place of
9247 ** a legal notice, here is a blessing:
@@ -9290,10 +9312,11 @@
9312 #define sqlite3MutexEnd()
9313 #endif /* defined(SQLITE_MUTEX_OMIT) */
9314
9315 /************** End of mutex.h ***********************************************/
9316 /************** Continuing where we left off in sqliteInt.h ******************/
9317 #line 659 "tsrc/sqliteInt.h"
9318
9319
9320 /*
9321 ** Each database file to be accessed by the system is an instance
9322 ** of the following structure. There are normally two of these structures
@@ -11892,10 +11915,11 @@
11915
11916 #endif /* _SQLITEINT_H_ */
11917
11918 /************** End of sqliteInt.h *******************************************/
11919 /************** Begin file global.c ******************************************/
11920 #line 1 "tsrc/global.c"
11921 /*
11922 ** 2008 June 13
11923 **
11924 ** The author disclaims copyright to this source code. In place of
11925 ** a legal notice, here is a blessing:
@@ -12114,10 +12138,11 @@
12138 */
12139 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
12140
12141 /************** End of global.c **********************************************/
12142 /************** Begin file ctime.c *******************************************/
12143 #line 1 "tsrc/ctime.c"
12144 /*
12145 ** 2010 February 23
12146 **
12147 ** The author disclaims copyright to this source code. In place of
12148 ** a legal notice, here is a blessing:
@@ -12518,10 +12543,11 @@
12543
12544 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
12545
12546 /************** End of ctime.c ***********************************************/
12547 /************** Begin file status.c ******************************************/
12548 #line 1 "tsrc/status.c"
12549 /*
12550 ** 2008 June 18
12551 **
12552 ** The author disclaims copyright to this source code. In place of
12553 ** a legal notice, here is a blessing:
@@ -12535,10 +12561,11 @@
12561 ** This module implements the sqlite3_status() interface and related
12562 ** functionality.
12563 */
12564 /************** Include vdbeInt.h in the middle of status.c ******************/
12565 /************** Begin file vdbeInt.h *****************************************/
12566 #line 1 "tsrc/vdbeInt.h"
12567 /*
12568 ** 2003 September 6
12569 **
12570 ** The author disclaims copyright to this source code. In place of
12571 ** a legal notice, here is a blessing:
@@ -12986,10 +13013,11 @@
13013
13014 #endif /* !defined(_VDBEINT_H_) */
13015
13016 /************** End of vdbeInt.h *********************************************/
13017 /************** Continuing where we left off in status.c *********************/
13018 #line 18 "tsrc/status.c"
13019
13020 /*
13021 ** Variables in which to record status information.
13022 */
13023 typedef struct sqlite3StatType sqlite3StatType;
@@ -13199,10 +13227,11 @@
13227 return rc;
13228 }
13229
13230 /************** End of status.c **********************************************/
13231 /************** Begin file date.c ********************************************/
13232 #line 1 "tsrc/date.c"
13233 /*
13234 ** 2003 October 31
13235 **
13236 ** The author disclaims copyright to this source code. In place of
13237 ** a legal notice, here is a blessing:
@@ -14326,10 +14355,11 @@
14355 }
14356 }
14357
14358 /************** End of date.c ************************************************/
14359 /************** Begin file os.c **********************************************/
14360 #line 1 "tsrc/os.c"
14361 /*
14362 ** 2005 November 29
14363 **
14364 ** The author disclaims copyright to this source code. In place of
14365 ** a legal notice, here is a blessing:
@@ -14659,10 +14689,11 @@
14689 return SQLITE_OK;
14690 }
14691
14692 /************** End of os.c **************************************************/
14693 /************** Begin file fault.c *******************************************/
14694 #line 1 "tsrc/fault.c"
14695 /*
14696 ** 2008 Jan 22
14697 **
14698 ** The author disclaims copyright to this source code. In place of
14699 ** a legal notice, here is a blessing:
@@ -14748,10 +14779,11 @@
14779
14780 #endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */
14781
14782 /************** End of fault.c ***********************************************/
14783 /************** Begin file mem0.c ********************************************/
14784 #line 1 "tsrc/mem0.c"
14785 /*
14786 ** 2008 October 28
14787 **
14788 ** The author disclaims copyright to this source code. In place of
14789 ** a legal notice, here is a blessing:
@@ -14809,10 +14841,11 @@
14841
14842 #endif /* SQLITE_ZERO_MALLOC */
14843
14844 /************** End of mem0.c ************************************************/
14845 /************** Begin file mem1.c ********************************************/
14846 #line 1 "tsrc/mem1.c"
14847 /*
14848 ** 2007 August 14
14849 **
14850 ** The author disclaims copyright to this source code. In place of
14851 ** a legal notice, here is a blessing:
@@ -14961,10 +14994,11 @@
14994
14995 #endif /* SQLITE_SYSTEM_MALLOC */
14996
14997 /************** End of mem1.c ************************************************/
14998 /************** Begin file mem2.c ********************************************/
14999 #line 1 "tsrc/mem2.c"
15000 /*
15001 ** 2007 August 15
15002 **
15003 ** The author disclaims copyright to this source code. In place of
15004 ** a legal notice, here is a blessing:
@@ -15491,10 +15525,11 @@
15525
15526 #endif /* SQLITE_MEMDEBUG */
15527
15528 /************** End of mem2.c ************************************************/
15529 /************** Begin file mem3.c ********************************************/
15530 #line 1 "tsrc/mem3.c"
15531 /*
15532 ** 2007 October 14
15533 **
15534 ** The author disclaims copyright to this source code. In place of
15535 ** a legal notice, here is a blessing:
@@ -16180,10 +16215,11 @@
16215
16216 #endif /* SQLITE_ENABLE_MEMSYS3 */
16217
16218 /************** End of mem3.c ************************************************/
16219 /************** Begin file mem5.c ********************************************/
16220 #line 1 "tsrc/mem5.c"
16221 /*
16222 ** 2007 October 14
16223 **
16224 ** The author disclaims copyright to this source code. In place of
16225 ** a legal notice, here is a blessing:
@@ -16763,10 +16799,11 @@
16799
16800 #endif /* SQLITE_ENABLE_MEMSYS5 */
16801
16802 /************** End of mem5.c ************************************************/
16803 /************** Begin file mutex.c *******************************************/
16804 #line 1 "tsrc/mutex.c"
16805 /*
16806 ** 2007 August 14
16807 **
16808 ** The author disclaims copyright to this source code. In place of
16809 ** a legal notice, here is a blessing:
@@ -16918,10 +16955,11 @@
16955
16956 #endif /* SQLITE_MUTEX_OMIT */
16957
16958 /************** End of mutex.c ***********************************************/
16959 /************** Begin file mutex_noop.c **************************************/
16960 #line 1 "tsrc/mutex_noop.c"
16961 /*
16962 ** 2008 October 07
16963 **
16964 ** The author disclaims copyright to this source code. In place of
16965 ** a legal notice, here is a blessing:
@@ -17126,10 +17164,11 @@
17164 #endif /* SQLITE_MUTEX_NOOP */
17165 #endif /* SQLITE_MUTEX_OMIT */
17166
17167 /************** End of mutex_noop.c ******************************************/
17168 /************** Begin file mutex_os2.c ***************************************/
17169 #line 1 "tsrc/mutex_os2.c"
17170 /*
17171 ** 2007 August 28
17172 **
17173 ** The author disclaims copyright to this source code. In place of
17174 ** a legal notice, here is a blessing:
@@ -17402,10 +17441,11 @@
17441 }
17442 #endif /* SQLITE_MUTEX_OS2 */
17443
17444 /************** End of mutex_os2.c *******************************************/
17445 /************** Begin file mutex_unix.c **************************************/
17446 #line 1 "tsrc/mutex_unix.c"
17447 /*
17448 ** 2007 August 28
17449 **
17450 ** The author disclaims copyright to this source code. In place of
17451 ** a legal notice, here is a blessing:
@@ -17755,10 +17795,11 @@
17795
17796 #endif /* SQLITE_MUTEX_PTHREAD */
17797
17798 /************** End of mutex_unix.c ******************************************/
17799 /************** Begin file mutex_w32.c ***************************************/
17800 #line 1 "tsrc/mutex_w32.c"
17801 /*
17802 ** 2007 August 14
17803 **
17804 ** The author disclaims copyright to this source code. In place of
17805 ** a legal notice, here is a blessing:
@@ -18089,10 +18130,11 @@
18130 }
18131 #endif /* SQLITE_MUTEX_W32 */
18132
18133 /************** End of mutex_w32.c *******************************************/
18134 /************** Begin file malloc.c ******************************************/
18135 #line 1 "tsrc/malloc.c"
18136 /*
18137 ** 2001 September 15
18138 **
18139 ** The author disclaims copyright to this source code. In place of
18140 ** a legal notice, here is a blessing:
@@ -18868,10 +18910,11 @@
18910 return rc & (db ? db->errMask : 0xff);
18911 }
18912
18913 /************** End of malloc.c **********************************************/
18914 /************** Begin file printf.c ******************************************/
18915 #line 1 "tsrc/printf.c"
18916 /*
18917 ** The "printf" code that follows dates from the 1980's. It is in
18918 ** the public domain. The original comments are included here for
18919 ** completeness. They are very out-of-date but might be useful as
18920 ** an historical reference. Most of the "enhancements" have been backed
@@ -19899,10 +19942,11 @@
19942 }
19943 #endif
19944
19945 /************** End of printf.c **********************************************/
19946 /************** Begin file random.c ******************************************/
19947 #line 1 "tsrc/random.c"
19948 /*
19949 ** 2001 September 15
19950 **
19951 ** The author disclaims copyright to this source code. In place of
19952 ** a legal notice, here is a blessing:
@@ -20046,10 +20090,11 @@
20090 }
20091 #endif /* SQLITE_OMIT_BUILTIN_TEST */
20092
20093 /************** End of random.c **********************************************/
20094 /************** Begin file utf.c *********************************************/
20095 #line 1 "tsrc/utf.c"
20096 /*
20097 ** 2004 April 13
20098 **
20099 ** The author disclaims copyright to this source code. In place of
20100 ** a legal notice, here is a blessing:
@@ -20607,10 +20652,11 @@
20652 #endif /* SQLITE_TEST */
20653 #endif /* SQLITE_OMIT_UTF16 */
20654
20655 /************** End of utf.c *************************************************/
20656 /************** Begin file util.c ********************************************/
20657 #line 1 "tsrc/util.c"
20658 /*
20659 ** 2001 September 15
20660 **
20661 ** The author disclaims copyright to this source code. In place of
20662 ** a legal notice, here is a blessing:
@@ -21789,10 +21835,11 @@
21835 }
21836 #endif
21837
21838 /************** End of util.c ************************************************/
21839 /************** Begin file hash.c ********************************************/
21840 #line 1 "tsrc/hash.c"
21841 /*
21842 ** 2001 September 22
21843 **
21844 ** The author disclaims copyright to this source code. In place of
21845 ** a legal notice, here is a blessing:
@@ -22068,10 +22115,11 @@
22115 return 0;
22116 }
22117
22118 /************** End of hash.c ************************************************/
22119 /************** Begin file opcodes.c *****************************************/
22120 #line 1 "tsrc/opcodes.c"
22121 /* Automatically generated. Do not edit */
22122 /* See the mkopcodec.awk script for details. */
22123 #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
22124 SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
22125 static const char *const azName[] = { "?",
@@ -22229,10 +22277,11 @@
22277 }
22278 #endif
22279
22280 /************** End of opcodes.c *********************************************/
22281 /************** Begin file os_os2.c ******************************************/
22282 #line 1 "tsrc/os_os2.c"
22283 /*
22284 ** 2006 Feb 14
22285 **
22286 ** The author disclaims copyright to this source code. In place of
22287 ** a legal notice, here is a blessing:
@@ -22285,10 +22334,11 @@
22334 /*
22335 ** Include code that is common to all os_*.c files
22336 */
22337 /************** Include os_common.h in the middle of os_os2.c ****************/
22338 /************** Begin file os_common.h ***************************************/
22339 #line 1 "tsrc/os_common.h"
22340 /*
22341 ** 2004 May 22
22342 **
22343 ** The author disclaims copyright to this source code. In place of
22344 ** a legal notice, here is a blessing:
@@ -22338,10 +22388,11 @@
22388 ** hwtime.h contains inline assembler code for implementing
22389 ** high-performance timing routines.
22390 */
22391 /************** Include hwtime.h in the middle of os_common.h ****************/
22392 /************** Begin file hwtime.h ******************************************/
22393 #line 1 "tsrc/hwtime.h"
22394 /*
22395 ** 2008 May 27
22396 **
22397 ** The author disclaims copyright to this source code. In place of
22398 ** a legal notice, here is a blessing:
@@ -22426,10 +22477,11 @@
22477
22478 #endif /* !defined(_HWTIME_H_) */
22479
22480 /************** End of hwtime.h **********************************************/
22481 /************** Continuing where we left off in os_common.h ******************/
22482 #line 53 "tsrc/os_common.h"
22483
22484 static sqlite_uint64 g_start;
22485 static sqlite_uint64 g_elapsed;
22486 #define TIMER_START g_start=sqlite3Hwtime()
22487 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -22492,10 +22544,11 @@
22544
22545 #endif /* !defined(_OS_COMMON_H_) */
22546
22547 /************** End of os_common.h *******************************************/
22548 /************** Continuing where we left off in os_os2.c *********************/
22549 #line 57 "tsrc/os_os2.c"
22550
22551 /* Forward references */
22552 typedef struct os2File os2File; /* The file structure */
22553 typedef struct os2ShmNode os2ShmNode; /* A shared descritive memory node */
22554 typedef struct os2ShmLink os2ShmLink; /* A connection to shared-memory */
@@ -24363,10 +24416,11 @@
24416
24417 #endif /* SQLITE_OS_OS2 */
24418
24419 /************** End of os_os2.c **********************************************/
24420 /************** Begin file os_unix.c *****************************************/
24421 #line 1 "tsrc/os_unix.c"
24422 /*
24423 ** 2004 May 22
24424 **
24425 ** The author disclaims copyright to this source code. In place of
24426 ** a legal notice, here is a blessing:
@@ -24627,10 +24681,11 @@
24681 /*
24682 ** Include code that is common to all os_*.c files
24683 */
24684 /************** Include os_common.h in the middle of os_unix.c ***************/
24685 /************** Begin file os_common.h ***************************************/
24686 #line 1 "tsrc/os_common.h"
24687 /*
24688 ** 2004 May 22
24689 **
24690 ** The author disclaims copyright to this source code. In place of
24691 ** a legal notice, here is a blessing:
@@ -24680,10 +24735,11 @@
24735 ** hwtime.h contains inline assembler code for implementing
24736 ** high-performance timing routines.
24737 */
24738 /************** Include hwtime.h in the middle of os_common.h ****************/
24739 /************** Begin file hwtime.h ******************************************/
24740 #line 1 "tsrc/hwtime.h"
24741 /*
24742 ** 2008 May 27
24743 **
24744 ** The author disclaims copyright to this source code. In place of
24745 ** a legal notice, here is a blessing:
@@ -24768,10 +24824,11 @@
24824
24825 #endif /* !defined(_HWTIME_H_) */
24826
24827 /************** End of hwtime.h **********************************************/
24828 /************** Continuing where we left off in os_common.h ******************/
24829 #line 53 "tsrc/os_common.h"
24830
24831 static sqlite_uint64 g_start;
24832 static sqlite_uint64 g_elapsed;
24833 #define TIMER_START g_start=sqlite3Hwtime()
24834 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -24834,10 +24891,11 @@
24891
24892 #endif /* !defined(_OS_COMMON_H_) */
24893
24894 /************** End of os_common.h *******************************************/
24895 /************** Continuing where we left off in os_unix.c ********************/
24896 #line 265 "tsrc/os_unix.c"
24897
24898 /*
24899 ** Define various macros that are missing from some systems.
24900 */
24901 #ifndef O_LARGEFILE
@@ -31343,10 +31401,11 @@
31401
31402 #endif /* SQLITE_OS_UNIX */
31403
31404 /************** End of os_unix.c *********************************************/
31405 /************** Begin file os_win.c ******************************************/
31406 #line 1 "tsrc/os_win.c"
31407 /*
31408 ** 2004 May 22
31409 **
31410 ** The author disclaims copyright to this source code. In place of
31411 ** a legal notice, here is a blessing:
@@ -31404,10 +31463,11 @@
31463 /*
31464 ** Include code that is common to all os_*.c files
31465 */
31466 /************** Include os_common.h in the middle of os_win.c ****************/
31467 /************** Begin file os_common.h ***************************************/
31468 #line 1 "tsrc/os_common.h"
31469 /*
31470 ** 2004 May 22
31471 **
31472 ** The author disclaims copyright to this source code. In place of
31473 ** a legal notice, here is a blessing:
@@ -31457,10 +31517,11 @@
31517 ** hwtime.h contains inline assembler code for implementing
31518 ** high-performance timing routines.
31519 */
31520 /************** Include hwtime.h in the middle of os_common.h ****************/
31521 /************** Begin file hwtime.h ******************************************/
31522 #line 1 "tsrc/hwtime.h"
31523 /*
31524 ** 2008 May 27
31525 **
31526 ** The author disclaims copyright to this source code. In place of
31527 ** a legal notice, here is a blessing:
@@ -31545,10 +31606,11 @@
31606
31607 #endif /* !defined(_HWTIME_H_) */
31608
31609 /************** End of hwtime.h **********************************************/
31610 /************** Continuing where we left off in os_common.h ******************/
31611 #line 53 "tsrc/os_common.h"
31612
31613 static sqlite_uint64 g_start;
31614 static sqlite_uint64 g_elapsed;
31615 #define TIMER_START g_start=sqlite3Hwtime()
31616 #define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
@@ -31611,10 +31673,11 @@
31673
31674 #endif /* !defined(_OS_COMMON_H_) */
31675
31676 /************** End of os_common.h *******************************************/
31677 /************** Continuing where we left off in os_win.c *********************/
31678 #line 62 "tsrc/os_win.c"
31679
31680 /*
31681 ** Some microsoft compilers lack this definition.
31682 */
31683 #ifndef INVALID_FILE_ATTRIBUTES
@@ -34746,10 +34809,11 @@
34809
34810 #endif /* SQLITE_OS_WIN */
34811
34812 /************** End of os_win.c **********************************************/
34813 /************** Begin file bitvec.c ******************************************/
34814 #line 1 "tsrc/bitvec.c"
34815 /*
34816 ** 2008 February 16
34817 **
34818 ** The author disclaims copyright to this source code. In place of
34819 ** a legal notice, here is a blessing:
@@ -35156,10 +35220,11 @@
35220 }
35221 #endif /* SQLITE_OMIT_BUILTIN_TEST */
35222
35223 /************** End of bitvec.c **********************************************/
35224 /************** Begin file pcache.c ******************************************/
35225 #line 1 "tsrc/pcache.c"
35226 /*
35227 ** 2008 August 05
35228 **
35229 ** The author disclaims copyright to this source code. In place of
35230 ** a legal notice, here is a blessing:
@@ -35752,10 +35817,11 @@
35817 }
35818 #endif
35819
35820 /************** End of pcache.c **********************************************/
35821 /************** Begin file pcache1.c *****************************************/
35822 #line 1 "tsrc/pcache1.c"
35823 /*
35824 ** 2008 November 05
35825 **
35826 ** The author disclaims copyright to this source code. In place of
35827 ** a legal notice, here is a blessing:
@@ -36968,10 +37034,11 @@
37034 }
37035 #endif
37036
37037 /************** End of pcache1.c *********************************************/
37038 /************** Begin file rowset.c ******************************************/
37039 #line 1 "tsrc/rowset.c"
37040 /*
37041 ** 2008 December 3
37042 **
37043 ** The author disclaims copyright to this source code. In place of
37044 ** a legal notice, here is a blessing:
@@ -37392,10 +37459,11 @@
37459 return 0;
37460 }
37461
37462 /************** End of rowset.c **********************************************/
37463 /************** Begin file pager.c *******************************************/
37464 #line 1 "tsrc/pager.c"
37465 /*
37466 ** 2001 September 15
37467 **
37468 ** The author disclaims copyright to this source code. In place of
37469 ** a legal notice, here is a blessing:
@@ -37415,10 +37483,11 @@
37483 ** another is writing.
37484 */
37485 #ifndef SQLITE_OMIT_DISKIO
37486 /************** Include wal.h in the middle of pager.c ***********************/
37487 /************** Begin file wal.h *********************************************/
37488 #line 1 "tsrc/wal.h"
37489 /*
37490 ** 2010 February 1
37491 **
37492 ** The author disclaims copyright to this source code. In place of
37493 ** a legal notice, here is a blessing:
@@ -37539,10 +37608,11 @@
37608 #endif /* ifndef SQLITE_OMIT_WAL */
37609 #endif /* _WAL_H_ */
37610
37611 /************** End of wal.h *************************************************/
37612 /************** Continuing where we left off in pager.c **********************/
37613 #line 24 "tsrc/pager.c"
37614
37615
37616 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
37617 **
37618 ** This comment block describes invariants that hold when using a rollback
@@ -44352,10 +44422,11 @@
44422
44423 #endif /* SQLITE_OMIT_DISKIO */
44424
44425 /************** End of pager.c ***********************************************/
44426 /************** Begin file wal.c *********************************************/
44427 #line 1 "tsrc/wal.c"
44428 /*
44429 ** 2010 February 1
44430 **
44431 ** The author disclaims copyright to this source code. In place of
44432 ** a legal notice, here is a blessing:
@@ -47306,10 +47377,11 @@
47377
47378 #endif /* #ifndef SQLITE_OMIT_WAL */
47379
47380 /************** End of wal.c *************************************************/
47381 /************** Begin file btmutex.c *****************************************/
47382 #line 1 "tsrc/btmutex.c"
47383 /*
47384 ** 2007 August 27
47385 **
47386 ** The author disclaims copyright to this source code. In place of
47387 ** a legal notice, here is a blessing:
@@ -47325,10 +47397,11 @@
47397 ** big and we want to break it down some. This packaged seemed like
47398 ** a good breakout.
47399 */
47400 /************** Include btreeInt.h in the middle of btmutex.c ****************/
47401 /************** Begin file btreeInt.h ****************************************/
47402 #line 1 "tsrc/btreeInt.h"
47403 /*
47404 ** 2004 April 6
47405 **
47406 ** The author disclaims copyright to this source code. In place of
47407 ** a legal notice, here is a blessing:
@@ -47970,10 +48043,11 @@
48043 #define get4byte sqlite3Get4byte
48044 #define put4byte sqlite3Put4byte
48045
48046 /************** End of btreeInt.h ********************************************/
48047 /************** Continuing where we left off in btmutex.c ********************/
48048 #line 19 "tsrc/btmutex.c"
48049 #ifndef SQLITE_OMIT_SHARED_CACHE
48050 #if SQLITE_THREADSAFE
48051
48052 /*
48053 ** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -48242,10 +48316,11 @@
48316 #endif /* if SQLITE_THREADSAFE */
48317 #endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
48318
48319 /************** End of btmutex.c *********************************************/
48320 /************** Begin file btree.c *******************************************/
48321 #line 1 "tsrc/btree.c"
48322 /*
48323 ** 2004 April 6
48324 **
48325 ** The author disclaims copyright to this source code. In place of
48326 ** a legal notice, here is a blessing:
@@ -48899,22 +48974,25 @@
48974 int *pRes /* Write search results here */
48975 ){
48976 int rc; /* Status code */
48977 UnpackedRecord *pIdxKey; /* Unpacked index key */
48978 char aSpace[150]; /* Temp space for pIdxKey - to avoid a malloc */
48979 char *pFree = 0;
48980
48981 if( pKey ){
48982 assert( nKey==(i64)(int)nKey );
48983 pIdxKey = sqlite3VdbeAllocUnpackedRecord(
48984 pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
48985 );
48986 if( pIdxKey==0 ) return SQLITE_NOMEM;
48987 sqlite3VdbeRecordUnpack(pCur->pKeyInfo, nKey, pKey, pIdxKey);
48988 }else{
48989 pIdxKey = 0;
48990 }
48991 rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
48992 if( pFree ){
48993 sqlite3DbFree(pCur->pKeyInfo->db, pFree);
48994 }
48995 return rc;
48996 }
48997
48998 /*
@@ -56426,10 +56504,11 @@
56504 return rc;
56505 }
56506
56507 /************** End of btree.c ***********************************************/
56508 /************** Begin file backup.c ******************************************/
56509 #line 1 "tsrc/backup.c"
56510 /*
56511 ** 2009 January 28
56512 **
56513 ** The author disclaims copyright to this source code. In place of
56514 ** a legal notice, here is a blessing:
@@ -57132,10 +57211,11 @@
57211 }
57212 #endif /* SQLITE_OMIT_VACUUM */
57213
57214 /************** End of backup.c **********************************************/
57215 /************** Begin file vdbemem.c *****************************************/
57216 #line 1 "tsrc/vdbemem.c"
57217 /*
57218 ** 2004 May 26
57219 **
57220 ** The author disclaims copyright to this source code. In place of
57221 ** a legal notice, here is a blessing:
@@ -58286,10 +58366,11 @@
58366 return 0;
58367 }
58368
58369 /************** End of vdbemem.c *********************************************/
58370 /************** Begin file vdbeaux.c *****************************************/
58371 #line 1 "tsrc/vdbeaux.c"
58372 /*
58373 ** 2003 September 6
58374 **
58375 ** The author disclaims copyright to this source code. In place of
58376 ** a legal notice, here is a blessing:
@@ -61116,61 +61197,74 @@
61197 }
61198 }
61199 return 0;
61200 }
61201
61202 /*
61203 ** This routine is used to allocate sufficient space for an UnpackedRecord
61204 ** structure large enough to be used with sqlite3VdbeRecordUnpack() if
61205 ** the first argument is a pointer to KeyInfo structure pKeyInfo.
61206 **
61207 ** The space is either allocated using sqlite3DbMallocRaw() or from within
61208 ** the unaligned buffer passed via the second and third arguments (presumably
61209 ** stack space). If the former, then *ppFree is set to a pointer that should
61210 ** be eventually freed by the caller using sqlite3DbFree(). Or, if the
61211 ** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL
61212 ** before returning.
61213 **
61214 ** If an OOM error occurs, NULL is returned.
61215 */
61216 SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
61217 KeyInfo *pKeyInfo, /* Description of the record */
61218 char *pSpace, /* Unaligned space available */
61219 int szSpace, /* Size of pSpace[] in bytes */
61220 char **ppFree /* OUT: Caller should free this pointer */
61221 ){
61222 UnpackedRecord *p; /* Unpacked record to return */
61223 int nOff; /* Increment pSpace by nOff to align it */
61224 int nByte; /* Number of bytes required for *p */
61225
61226 /* We want to shift the pointer pSpace up such that it is 8-byte aligned.
 
 
 
 
 
 
 
 
61227 ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift
61228 ** it by. If pSpace is already 8-byte aligned, nOff should be zero.
61229 */
61230 nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;
 
 
61231 nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
61232 if( nByte>szSpace+nOff ){
61233 p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
61234 *ppFree = (char *)p;
61235 if( !p ) return 0;
61236 }else{
61237 p = (UnpackedRecord*)&pSpace[nOff];
61238 *ppFree = 0;
61239 }
61240
61241 p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
61242 p->pKeyInfo = pKeyInfo;
61243 p->nField = pKeyInfo->nField + 1;
61244 return p;
61245 }
61246
61247 /*
61248 ** Given the nKey-byte encoding of a record in pKey[], populate the
61249 ** UnpackedRecord structure indicated by the fourth argument with the
61250 ** contents of the decoded record.
61251 */
61252 SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
61253 KeyInfo *pKeyInfo, /* Information about the record format */
61254 int nKey, /* Size of the binary record */
61255 const void *pKey, /* The binary record */
61256 UnpackedRecord *p /* Populate this structure before returning. */
61257 ){
61258 const unsigned char *aKey = (const unsigned char *)pKey;
61259 int d;
61260 u32 idx; /* Offset in aKey[] to read from */
61261 u16 u; /* Unsigned loop counter */
61262 u32 szHdr;
61263 Mem *pMem = p->aMem;
61264
61265 p->flags = 0;
61266 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
61267 idx = getVarint32(aKey, szHdr);
61268 d = szHdr;
61269 u = 0;
61270 while( idx<szHdr && u<p->nField && d<=nKey ){
@@ -61185,35 +61279,10 @@
61279 pMem++;
61280 u++;
61281 }
61282 assert( u<=pKeyInfo->nField + 1 );
61283 p->nField = u;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61284 }
61285
61286 /*
61287 ** This function compares the two table rows or index records
61288 ** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
@@ -61540,10 +61609,11 @@
61609 }
61610 }
61611
61612 /************** End of vdbeaux.c *********************************************/
61613 /************** Begin file vdbeapi.c *****************************************/
61614 #line 1 "tsrc/vdbeapi.c"
61615 /*
61616 ** 2004 May 26
61617 **
61618 ** The author disclaims copyright to this source code. In place of
61619 ** a legal notice, here is a blessing:
@@ -62847,10 +62917,11 @@
62917 return v;
62918 }
62919
62920 /************** End of vdbeapi.c *********************************************/
62921 /************** Begin file vdbetrace.c ***************************************/
62922 #line 1 "tsrc/vdbetrace.c"
62923 /*
62924 ** 2009 November 25
62925 **
62926 ** The author disclaims copyright to this source code. In place of
62927 ** a legal notice, here is a blessing:
@@ -63002,10 +63073,11 @@
63073
63074 #endif /* #ifndef SQLITE_OMIT_TRACE */
63075
63076 /************** End of vdbetrace.c *******************************************/
63077 /************** Begin file vdbe.c ********************************************/
63078 #line 1 "tsrc/vdbe.c"
63079 /*
63080 ** 2001 September 15
63081 **
63082 ** The author disclaims copyright to this source code. In place of
63083 ** a legal notice, here is a blessing:
@@ -63471,10 +63543,11 @@
63543 ** hwtime.h contains inline assembler code for implementing
63544 ** high-performance timing routines.
63545 */
63546 /************** Include hwtime.h in the middle of vdbe.c *********************/
63547 /************** Begin file hwtime.h ******************************************/
63548 #line 1 "tsrc/hwtime.h"
63549 /*
63550 ** 2008 May 27
63551 **
63552 ** The author disclaims copyright to this source code. In place of
63553 ** a legal notice, here is a blessing:
@@ -63559,10 +63632,11 @@
63632
63633 #endif /* !defined(_HWTIME_H_) */
63634
63635 /************** End of hwtime.h **********************************************/
63636 /************** Continuing where we left off in vdbe.c ***********************/
63637 #line 471 "tsrc/vdbe.c"
63638
63639 #endif
63640
63641 /*
63642 ** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
@@ -63853,10 +63927,11 @@
63927 } bb;
63928 struct OP_Found_stack_vars {
63929 int alreadyExists;
63930 VdbeCursor *pC;
63931 int res;
63932 char *pFree;
63933 UnpackedRecord *pIdxKey;
63934 UnpackedRecord r;
63935 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
63936 } bc;
63937 struct OP_IsUnique_stack_vars {
@@ -67097,10 +67172,11 @@
67172 case OP_Found: { /* jump, in3 */
67173 #if 0 /* local variables moved into u.bc */
67174 int alreadyExists;
67175 VdbeCursor *pC;
67176 int res;
67177 char *pFree;
67178 UnpackedRecord *pIdxKey;
67179 UnpackedRecord r;
67180 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
67181 #endif /* local variables moved into u.bc */
67182
@@ -67125,22 +67201,22 @@
67201 { int i; for(i=0; i<u.bc.r.nField; i++) assert( memIsValid(&u.bc.r.aMem[i]) ); }
67202 #endif
67203 u.bc.r.flags = UNPACKED_PREFIX_MATCH;
67204 u.bc.pIdxKey = &u.bc.r;
67205 }else{
67206 u.bc.pIdxKey = sqlite3VdbeAllocUnpackedRecord(
67207 u.bc.pC->pKeyInfo, u.bc.aTempRec, sizeof(u.bc.aTempRec), &u.bc.pFree
67208 );
67209 if( u.bc.pIdxKey==0 ) goto no_mem;
67210 assert( pIn3->flags & MEM_Blob );
67211 assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */
67212 sqlite3VdbeRecordUnpack(u.bc.pC->pKeyInfo, pIn3->n, pIn3->z, u.bc.pIdxKey);
 
 
 
 
67213 u.bc.pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
67214 }
67215 rc = sqlite3BtreeMovetoUnpacked(u.bc.pC->pCursor, u.bc.pIdxKey, 0, 0, &u.bc.res);
67216 if( pOp->p4.i==0 ){
67217 sqlite3DbFree(db, u.bc.pFree);
67218 }
67219 if( rc!=SQLITE_OK ){
67220 break;
67221 }
67222 u.bc.alreadyExists = (u.bc.res==0);
@@ -69784,10 +69860,11 @@
69860 goto vdbe_error_halt;
69861 }
69862
69863 /************** End of vdbe.c ************************************************/
69864 /************** Begin file vdbeblob.c ****************************************/
69865 #line 1 "tsrc/vdbeblob.c"
69866 /*
69867 ** 2007 May 1
69868 **
69869 ** The author disclaims copyright to this source code. In place of
69870 ** a legal notice, here is a blessing:
@@ -70254,10 +70331,11 @@
70331
70332 #endif /* #ifndef SQLITE_OMIT_INCRBLOB */
70333
70334 /************** End of vdbeblob.c ********************************************/
70335 /************** Begin file vdbesort.c ****************************************/
70336 #line 1 "tsrc/vdbesort.c"
70337 /*
70338 ** 2011 July 9
70339 **
70340 ** The author disclaims copyright to this source code. In place of
70341 ** a legal notice, here is a blessing:
@@ -70358,12 +70436,11 @@
70436 sqlite3_file *pTemp1; /* PMA file 1 */
70437 int nPMA; /* Number of PMAs stored in pTemp1 */
70438 SorterRecord *pRecord; /* Head of in-memory record list */
70439 int mnPmaSize; /* Minimum PMA size, in bytes */
70440 int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
70441 UnpackedRecord *pUnpacked; /* Used to unpack keys */
 
70442 };
70443
70444 /*
70445 ** The following type is an iterator for a PMA. It caches the current key in
70446 ** variables nKey/aKey. If the iterator is at EOF, pFile==0.
@@ -70553,56 +70630,39 @@
70630 ** be less than key2. Even if key2 also contains NULL values.
70631 **
70632 ** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace
70633 ** has been allocated and contains an unpacked record that is used as key2.
70634 */
70635 static void vdbeSorterCompare(
70636 VdbeCursor *pCsr, /* Cursor object (for pKeyInfo) */
70637 int bOmitRowid, /* Ignore rowid field at end of keys */
70638 void *pKey1, int nKey1, /* Left side of comparison */
70639 void *pKey2, int nKey2, /* Right side of comparison */
70640 int *pRes /* OUT: Result of comparison */
70641 ){
70642 KeyInfo *pKeyInfo = pCsr->pKeyInfo;
70643 VdbeSorter *pSorter = pCsr->pSorter;
70644 UnpackedRecord *r2 = pSorter->pUnpacked;
 
 
70645 int i;
70646
 
 
 
 
 
 
 
 
70647 if( pKey2 ){
70648 sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, r2);
 
 
 
 
 
 
70649 }
70650
70651 if( bOmitRowid ){
70652 r2->nField = pKeyInfo->nField;
70653 assert( r2->nField>0 );
70654 for(i=0; i<r2->nField; i++){
70655 if( r2->aMem[i].flags & MEM_Null ){
70656 *pRes = -1;
70657 return;
70658 }
70659 }
70660 r2->flags |= UNPACKED_PREFIX_MATCH;
 
 
70661 }
70662
70663 *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
 
70664 }
70665
70666 /*
70667 ** This function is called to compare two iterator keys when merging
70668 ** multiple b-tree segments. Parameter iOut is the index of the aTree[]
@@ -70633,19 +70693,14 @@
70693 iRes = i2;
70694 }else if( p2->pFile==0 ){
70695 iRes = i1;
70696 }else{
70697 int res;
70698 assert( pCsr->pSorter->pUnpacked!=0 ); /* allocated in vdbeSorterMerge() */
70699 vdbeSorterCompare(
 
70700 pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res
70701 );
 
 
 
 
70702 if( res<=0 ){
70703 iRes = i1;
70704 }else{
70705 iRes = i2;
70706 }
@@ -70660,16 +70715,21 @@
70715 */
70716 SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
70717 int pgsz; /* Page size of main database */
70718 int mxCache; /* Cache size */
70719 VdbeSorter *pSorter; /* The new sorter */
70720 char *d; /* Dummy */
70721
70722 assert( pCsr->pKeyInfo && pCsr->pBt==0 );
70723 pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
70724 if( pSorter==0 ){
70725 return SQLITE_NOMEM;
70726 }
70727
70728 pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pCsr->pKeyInfo, 0, 0, &d);
70729 if( pSorter->pUnpacked==0 ) return SQLITE_NOMEM;
70730 assert( pSorter->pUnpacked==(UnpackedRecord *)d );
70731
70732 if( !sqlite3TempInMemory(db) ){
70733 pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
70734 pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
70735 mxCache = db->aDb[0].pSchema->cache_size;
@@ -70707,11 +70767,11 @@
70767 }
70768 if( pSorter->pTemp1 ){
70769 sqlite3OsCloseFree(pSorter->pTemp1);
70770 }
70771 vdbeSorterRecordFree(db, pSorter->pRecord);
70772 sqlite3DbFree(db, pSorter->pUnpacked);
70773 sqlite3DbFree(db, pSorter);
70774 pCsr->pSorter = 0;
70775 }
70776 }
70777
@@ -70728,36 +70788,26 @@
70788 SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE, &dummy
70789 );
70790 }
70791
70792 /*
70793 ** Merge the two sorted lists p1 and p2 into a single list.
70794 ** Set *ppOut to the head of the new list.
70795 */
70796 static void vdbeSorterMerge(
 
70797 VdbeCursor *pCsr, /* For pKeyInfo */
70798 SorterRecord *p1, /* First list to merge */
70799 SorterRecord *p2, /* Second list to merge */
70800 SorterRecord **ppOut /* OUT: Head of merged list */
70801 ){
 
70802 SorterRecord *pFinal = 0;
70803 SorterRecord **pp = &pFinal;
70804 void *pVal2 = p2 ? p2->pVal : 0;
70805
70806 while( p1 && p2 ){
70807 int res;
70808 vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);
 
 
 
 
 
 
 
 
70809 if( res<=0 ){
70810 *pp = p1;
70811 pp = &p1->pNext;
70812 p1 = p1->pNext;
70813 pVal2 = 0;
@@ -70768,22 +70818,19 @@
70818 if( p2==0 ) break;
70819 pVal2 = p2->pVal;
70820 }
70821 }
70822 *pp = p1 ? p1 : p2;
 
70823 *ppOut = pFinal;
 
70824 }
70825
70826 /*
70827 ** Sort the linked list of records headed at pCsr->pRecord. Return SQLITE_OK
70828 ** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error
70829 ** occurs.
70830 */
70831 static int vdbeSorterSort(VdbeCursor *pCsr){
 
70832 int i;
70833 SorterRecord **aSlot;
70834 SorterRecord *p;
70835 VdbeSorter *pSorter = pCsr->pSorter;
70836
@@ -70794,34 +70841,26 @@
70841
70842 p = pSorter->pRecord;
70843 while( p ){
70844 SorterRecord *pNext = p->pNext;
70845 p->pNext = 0;
70846 for(i=0; aSlot[i]; i++){
70847 vdbeSorterMerge(pCsr, p, aSlot[i], &p);
70848 aSlot[i] = 0;
70849 }
 
 
 
 
70850 aSlot[i] = p;
70851 p = pNext;
70852 }
70853
70854 p = 0;
70855 for(i=0; i<64; i++){
70856 vdbeSorterMerge(pCsr, p, aSlot[i], &p);
 
 
 
 
70857 }
70858 pSorter->pRecord = p;
70859
70860 sqlite3_free(aSlot);
70861 return SQLITE_OK;
70862 }
70863
70864
70865 /*
70866 ** Write the current contents of the in-memory linked-list to a PMA. Return
@@ -70843,11 +70882,11 @@
70882 if( pSorter->nInMemory==0 ){
70883 assert( pSorter->pRecord==0 );
70884 return rc;
70885 }
70886
70887 rc = vdbeSorterSort(pCsr);
70888
70889 /* If the first temporary PMA file has not been opened, open it now. */
70890 if( rc==SQLITE_OK && pSorter->pTemp1==0 ){
70891 rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);
70892 assert( rc!=SQLITE_OK || pSorter->pTemp1 );
@@ -70990,11 +71029,11 @@
71029 ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly
71030 ** from the in-memory list. */
71031 if( pSorter->nPMA==0 ){
71032 *pbEof = !pSorter->pRecord;
71033 assert( pSorter->aTree==0 );
71034 return vdbeSorterSort(pCsr);
71035 }
71036
71037 /* Write the current b-tree to a PMA. Close the b-tree cursor. */
71038 rc = vdbeSorterListToPMA(db, pCsr);
71039 if( rc!=SQLITE_OK ) return rc;
@@ -71160,24 +71199,23 @@
71199 SQLITE_PRIVATE int sqlite3VdbeSorterCompare(
71200 VdbeCursor *pCsr, /* Sorter cursor */
71201 Mem *pVal, /* Value to compare to current sorter key */
71202 int *pRes /* OUT: Result of comparison */
71203 ){
 
71204 VdbeSorter *pSorter = pCsr->pSorter;
71205 void *pKey; int nKey; /* Sorter key to compare pVal with */
71206
71207 pKey = vdbeSorterRowkey(pSorter, &nKey);
71208 vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
71209 return SQLITE_OK;
 
71210 }
71211
71212 #endif /* #ifndef SQLITE_OMIT_MERGE_SORT */
71213
71214 /************** End of vdbesort.c ********************************************/
71215 /************** Begin file journal.c *****************************************/
71216 #line 1 "tsrc/journal.c"
71217 /*
71218 ** 2007 August 22
71219 **
71220 ** The author disclaims copyright to this source code. In place of
71221 ** a legal notice, here is a blessing:
@@ -71414,10 +71452,11 @@
71452 }
71453 #endif
71454
71455 /************** End of journal.c *********************************************/
71456 /************** Begin file memjournal.c **************************************/
71457 #line 1 "tsrc/memjournal.c"
71458 /*
71459 ** 2008 October 7
71460 **
71461 ** The author disclaims copyright to this source code. In place of
71462 ** a legal notice, here is a blessing:
@@ -71675,10 +71714,11 @@
71714 return sizeof(MemJournal);
71715 }
71716
71717 /************** End of memjournal.c ******************************************/
71718 /************** Begin file walker.c ******************************************/
71719 #line 1 "tsrc/walker.c"
71720 /*
71721 ** 2008 August 16
71722 **
71723 ** The author disclaims copyright to this source code. In place of
71724 ** a legal notice, here is a blessing:
@@ -71813,10 +71853,11 @@
71853 return rc & WRC_Abort;
71854 }
71855
71856 /************** End of walker.c **********************************************/
71857 /************** Begin file resolve.c *****************************************/
71858 #line 1 "tsrc/resolve.c"
71859 /*
71860 ** 2008 August 18
71861 **
71862 ** The author disclaims copyright to this source code. In place of
71863 ** a legal notice, here is a blessing:
@@ -73033,10 +73074,11 @@
73074 sqlite3WalkSelect(&w, p);
73075 }
73076
73077 /************** End of resolve.c *********************************************/
73078 /************** Begin file expr.c ********************************************/
73079 #line 1 "tsrc/expr.c"
73080 /*
73081 ** 2001 September 15
73082 **
73083 ** The author disclaims copyright to this source code. In place of
73084 ** a legal notice, here is a blessing:
@@ -76793,10 +76835,11 @@
76835 }
76836 }
76837
76838 /************** End of expr.c ************************************************/
76839 /************** Begin file alter.c *******************************************/
76840 #line 1 "tsrc/alter.c"
76841 /*
76842 ** 2005 February 15
76843 **
76844 ** The author disclaims copyright to this source code. In place of
76845 ** a legal notice, here is a blessing:
@@ -77621,10 +77664,11 @@
77664 }
77665 #endif /* SQLITE_ALTER_TABLE */
77666
77667 /************** End of alter.c ***********************************************/
77668 /************** Begin file analyze.c *****************************************/
77669 #line 1 "tsrc/analyze.c"
77670 /*
77671 ** 2005 July 8
77672 **
77673 ** The author disclaims copyright to this source code. In place of
77674 ** a legal notice, here is a blessing:
@@ -78342,10 +78386,11 @@
78386
78387 #endif /* SQLITE_OMIT_ANALYZE */
78388
78389 /************** End of analyze.c *********************************************/
78390 /************** Begin file attach.c ******************************************/
78391 #line 1 "tsrc/attach.c"
78392 /*
78393 ** 2003 April 6
78394 **
78395 ** The author disclaims copyright to this source code. In place of
78396 ** a legal notice, here is a blessing:
@@ -78901,10 +78946,11 @@
78946 }
78947 #endif
78948
78949 /************** End of attach.c **********************************************/
78950 /************** Begin file auth.c ********************************************/
78951 #line 1 "tsrc/auth.c"
78952 /*
78953 ** 2003 January 11
78954 **
78955 ** The author disclaims copyright to this source code. In place of
78956 ** a legal notice, here is a blessing:
@@ -79152,10 +79198,11 @@
79198
79199 #endif /* SQLITE_OMIT_AUTHORIZATION */
79200
79201 /************** End of auth.c ************************************************/
79202 /************** Begin file build.c *******************************************/
79203 #line 1 "tsrc/build.c"
79204 /*
79205 ** 2001 September 15
79206 **
79207 ** The author disclaims copyright to this source code. In place of
79208 ** a legal notice, here is a blessing:
@@ -82955,10 +83002,11 @@
83002 return pKey;
83003 }
83004
83005 /************** End of build.c ***********************************************/
83006 /************** Begin file callback.c ****************************************/
83007 #line 1 "tsrc/callback.c"
83008 /*
83009 ** 2005 May 23
83010 **
83011 ** The author disclaims copyright to this source code. In place of
83012 ** a legal notice, here is a blessing:
@@ -83414,10 +83462,11 @@
83462 return p;
83463 }
83464
83465 /************** End of callback.c ********************************************/
83466 /************** Begin file delete.c ******************************************/
83467 #line 1 "tsrc/delete.c"
83468 /*
83469 ** 2001 September 15
83470 **
83471 ** The author disclaims copyright to this source code. In place of
83472 ** a legal notice, here is a blessing:
@@ -84068,10 +84117,11 @@
84117 return regBase;
84118 }
84119
84120 /************** End of delete.c **********************************************/
84121 /************** Begin file func.c ********************************************/
84122 #line 1 "tsrc/func.c"
84123 /*
84124 ** 2002 February 23
84125 **
84126 ** The author disclaims copyright to this source code. In place of
84127 ** a legal notice, here is a blessing:
@@ -85676,10 +85726,11 @@
85726 #endif
85727 }
85728
85729 /************** End of func.c ************************************************/
85730 /************** Begin file fkey.c ********************************************/
85731 #line 1 "tsrc/fkey.c"
85732 /*
85733 **
85734 ** The author disclaims copyright to this source code. In place of
85735 ** a legal notice, here is a blessing:
85736 **
@@ -86896,10 +86947,11 @@
86947 }
86948 #endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
86949
86950 /************** End of fkey.c ************************************************/
86951 /************** Begin file insert.c ******************************************/
86952 #line 1 "tsrc/insert.c"
86953 /*
86954 ** 2001 September 15
86955 **
86956 ** The author disclaims copyright to this source code. In place of
86957 ** a legal notice, here is a blessing:
@@ -88741,10 +88793,11 @@
88793 }
88794 #endif /* SQLITE_OMIT_XFER_OPT */
88795
88796 /************** End of insert.c **********************************************/
88797 /************** Begin file legacy.c ******************************************/
88798 #line 1 "tsrc/legacy.c"
88799 /*
88800 ** 2001 September 15
88801 **
88802 ** The author disclaims copyright to this source code. In place of
88803 ** a legal notice, here is a blessing:
@@ -88888,10 +88941,11 @@
88941 return rc;
88942 }
88943
88944 /************** End of legacy.c **********************************************/
88945 /************** Begin file loadext.c *****************************************/
88946 #line 1 "tsrc/loadext.c"
88947 /*
88948 ** 2006 June 7
88949 **
88950 ** The author disclaims copyright to this source code. In place of
88951 ** a legal notice, here is a blessing:
@@ -88908,10 +88962,11 @@
88962 #ifndef SQLITE_CORE
88963 #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
88964 #endif
88965 /************** Include sqlite3ext.h in the middle of loadext.c **************/
88966 /************** Begin file sqlite3ext.h **************************************/
88967 #line 1 "tsrc/sqlite3ext.h"
88968 /*
88969 ** 2006 June 7
88970 **
88971 ** The author disclaims copyright to this source code. In place of
88972 ** a legal notice, here is a blessing:
@@ -89336,10 +89391,11 @@
89391
89392 #endif /* _SQLITE3EXT_H_ */
89393
89394 /************** End of sqlite3ext.h ******************************************/
89395 /************** Continuing where we left off in loadext.c ********************/
89396 #line 20 "tsrc/loadext.c"
89397 /* #include <string.h> */
89398
89399 #ifndef SQLITE_OMIT_LOAD_EXTENSION
89400
89401 /*
@@ -89975,10 +90031,11 @@
90031 }
90032 }
90033
90034 /************** End of loadext.c *********************************************/
90035 /************** Begin file pragma.c ******************************************/
90036 #line 1 "tsrc/pragma.c"
90037 /*
90038 ** 2003 April 6
90039 **
90040 ** The author disclaims copyright to this source code. In place of
90041 ** a legal notice, here is a blessing:
@@ -91503,10 +91560,11 @@
91560
91561 #endif /* SQLITE_OMIT_PRAGMA */
91562
91563 /************** End of pragma.c **********************************************/
91564 /************** Begin file prepare.c *****************************************/
91565 #line 1 "tsrc/prepare.c"
91566 /*
91567 ** 2005 May 25
91568 **
91569 ** The author disclaims copyright to this source code. In place of
91570 ** a legal notice, here is a blessing:
@@ -92363,10 +92421,11 @@
92421
92422 #endif /* SQLITE_OMIT_UTF16 */
92423
92424 /************** End of prepare.c *********************************************/
92425 /************** Begin file select.c ******************************************/
92426 #line 1 "tsrc/select.c"
92427 /*
92428 ** 2001 September 15
92429 **
92430 ** The author disclaims copyright to this source code. In place of
92431 ** a legal notice, here is a blessing:
@@ -96922,10 +96981,11 @@
96981 *****************************************************************************/
96982 #endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
96983
96984 /************** End of select.c **********************************************/
96985 /************** Begin file table.c *******************************************/
96986 #line 1 "tsrc/table.c"
96987 /*
96988 ** 2001 September 15
96989 **
96990 ** The author disclaims copyright to this source code. In place of
96991 ** a legal notice, here is a blessing:
@@ -97121,10 +97181,11 @@
97181
97182 #endif /* SQLITE_OMIT_GET_TABLE */
97183
97184 /************** End of table.c ***********************************************/
97185 /************** Begin file trigger.c *****************************************/
97186 #line 1 "tsrc/trigger.c"
97187 /*
97188 **
97189 ** The author disclaims copyright to this source code. In place of
97190 ** a legal notice, here is a blessing:
97191 **
@@ -98246,10 +98307,11 @@
98307
98308 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
98309
98310 /************** End of trigger.c *********************************************/
98311 /************** Begin file update.c ******************************************/
98312 #line 1 "tsrc/update.c"
98313 /*
98314 ** 2001 September 15
98315 **
98316 ** The author disclaims copyright to this source code. In place of
98317 ** a legal notice, here is a blessing:
@@ -98918,10 +98980,11 @@
98980 }
98981 #endif /* SQLITE_OMIT_VIRTUALTABLE */
98982
98983 /************** End of update.c **********************************************/
98984 /************** Begin file vacuum.c ******************************************/
98985 #line 1 "tsrc/vacuum.c"
98986 /*
98987 ** 2003 April 6
98988 **
98989 ** The author disclaims copyright to this source code. In place of
98990 ** a legal notice, here is a blessing:
@@ -99264,10 +99327,11 @@
99327
99328 #endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
99329
99330 /************** End of vacuum.c **********************************************/
99331 /************** Begin file vtab.c ********************************************/
99332 #line 1 "tsrc/vtab.c"
99333 /*
99334 ** 2006 June 10
99335 **
99336 ** The author disclaims copyright to this source code. In place of
99337 ** a legal notice, here is a blessing:
@@ -100332,10 +100396,11 @@
100396
100397 #endif /* SQLITE_OMIT_VIRTUALTABLE */
100398
100399 /************** End of vtab.c ************************************************/
100400 /************** Begin file where.c *******************************************/
100401 #line 1 "tsrc/where.c"
100402 /*
100403 ** 2001 September 15
100404 **
100405 ** The author disclaims copyright to this source code. In place of
100406 ** a legal notice, here is a blessing:
@@ -105518,10 +105583,11 @@
105583 return;
105584 }
105585
105586 /************** End of where.c ***********************************************/
105587 /************** Begin file parse.c *******************************************/
105588 #line 1 "tsrc/parse.c"
105589 /* Driver template for the LEMON parser generator.
105590 ** The author disclaims copyright to this source code.
105591 **
105592 ** This version of "lempar.c" is modified, slightly, for use by SQLite.
105593 ** The only modifications are the addition of a couple of NEVER()
@@ -105530,10 +105596,11 @@
105596 ** specific grammar used by SQLite.
105597 */
105598 /* First off, code is included that follows the "include" declaration
105599 ** in the input grammar file. */
105600 /* #include <stdio.h> */
105601 #line 51 "parse.y"
105602
105603
105604 /*
105605 ** Disable all error recovery processing in the parser push-down
105606 ** automaton.
@@ -105577,10 +105644,11 @@
105644 /*
105645 ** An instance of this structure holds the ATTACH key and the key type.
105646 */
105647 struct AttachKey { int type; Token key; };
105648
105649 #line 722 "parse.y"
105650
105651 /* This is a utility routine used to set the ExprSpan.zStart and
105652 ** ExprSpan.zEnd values of pOut so that the span covers the complete
105653 ** range of text beginning with pStart and going to the end of pEnd.
105654 */
@@ -105596,10 +105664,11 @@
105664 static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){
105665 pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue);
105666 pOut->zStart = pValue->z;
105667 pOut->zEnd = &pValue->z[pValue->n];
105668 }
105669 #line 817 "parse.y"
105670
105671 /* This routine constructs a binary expression node out of two ExprSpan
105672 ** objects and uses the result to populate a new ExprSpan object.
105673 */
105674 static void spanBinaryExpr(
@@ -105611,10 +105680,11 @@
105680 ){
105681 pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);
105682 pOut->zStart = pLeft->zStart;
105683 pOut->zEnd = pRight->zEnd;
105684 }
105685 #line 873 "parse.y"
105686
105687 /* Construct an expression node for a unary postfix operator
105688 */
105689 static void spanUnaryPostfix(
105690 ExprSpan *pOut, /* Write the new expression node here */
@@ -105625,10 +105695,11 @@
105695 ){
105696 pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105697 pOut->zStart = pOperand->zStart;
105698 pOut->zEnd = &pPostOp->z[pPostOp->n];
105699 }
105700 #line 892 "parse.y"
105701
105702 /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
105703 ** unary TK_ISNULL or TK_NOTNULL expression. */
105704 static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
105705 sqlite3 *db = pParse->db;
@@ -105636,10 +105707,11 @@
105707 pA->op = (u8)op;
105708 sqlite3ExprDelete(db, pA->pRight);
105709 pA->pRight = 0;
105710 }
105711 }
105712 #line 920 "parse.y"
105713
105714 /* Construct an expression node for a unary prefix operator
105715 */
105716 static void spanUnaryPrefix(
105717 ExprSpan *pOut, /* Write the new expression node here */
@@ -105650,10 +105722,11 @@
105722 ){
105723 pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
105724 pOut->zStart = pPreOp->z;
105725 pOut->zEnd = pOperand->zEnd;
105726 }
105727 #line 141 "parse.c"
105728 /* Next is all token values, in a form suitable for use by makeheaders.
105729 ** This section will be null unless lemon is run with the -m switch.
105730 */
105731 /*
105732 ** These constants (all generated automatically by the parser generator)
@@ -106905,17 +106978,21 @@
106978 ** inside the C code.
106979 */
106980 case 160: /* select */
106981 case 194: /* oneselect */
106982 {
106983 #line 403 "parse.y"
106984 sqlite3SelectDelete(pParse->db, (yypminor->yy387));
106985 #line 1399 "parse.c"
106986 }
106987 break;
106988 case 174: /* term */
106989 case 175: /* expr */
106990 {
106991 #line 720 "parse.y"
106992 sqlite3ExprDelete(pParse->db, (yypminor->yy118).pExpr);
106993 #line 1407 "parse.c"
106994 }
106995 break;
106996 case 179: /* idxlist_opt */
106997 case 187: /* idxlist */
106998 case 197: /* selcollist */
@@ -106927,19 +107004,23 @@
107004 case 217: /* setlist */
107005 case 220: /* itemlist */
107006 case 221: /* exprlist */
107007 case 226: /* case_exprlist */
107008 {
107009 #line 1103 "parse.y"
107010 sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
107011 #line 1425 "parse.c"
107012 }
107013 break;
107014 case 193: /* fullname */
107015 case 198: /* from */
107016 case 206: /* seltablist */
107017 case 207: /* stl_prefix */
107018 {
107019 #line 534 "parse.y"
107020 sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
107021 #line 1435 "parse.c"
107022 }
107023 break;
107024 case 199: /* where_opt */
107025 case 201: /* having_opt */
107026 case 210: /* on_opt */
@@ -106947,29 +107028,37 @@
107028 case 225: /* case_operand */
107029 case 227: /* case_else */
107030 case 238: /* when_clause */
107031 case 243: /* key_opt */
107032 {
107033 #line 644 "parse.y"
107034 sqlite3ExprDelete(pParse->db, (yypminor->yy314));
107035 #line 1449 "parse.c"
107036 }
107037 break;
107038 case 211: /* using_opt */
107039 case 213: /* inscollist */
107040 case 219: /* inscollist_opt */
107041 {
107042 #line 566 "parse.y"
107043 sqlite3IdListDelete(pParse->db, (yypminor->yy384));
107044 #line 1458 "parse.c"
107045 }
107046 break;
107047 case 234: /* trigger_cmd_list */
107048 case 239: /* trigger_cmd */
107049 {
107050 #line 1210 "parse.y"
107051 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
107052 #line 1466 "parse.c"
107053 }
107054 break;
107055 case 236: /* trigger_event */
107056 {
107057 #line 1196 "parse.y"
107058 sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
107059 #line 1473 "parse.c"
107060 }
107061 break;
107062 default: break; /* If no destructor action specified: do nothing */
107063 }
107064 }
@@ -107151,14 +107240,16 @@
107240 }
107241 #endif
107242 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
107243 /* Here code is inserted which will execute if the parser
107244 ** stack every overflows */
107245 #line 38 "parse.y"
107246
107247 UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */
107248 sqlite3ErrorMsg(pParse, "parser stack overflow");
107249 pParse->parseError = 1;
107250 #line 1664 "parse.c"
107251 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
107252 }
107253
107254 /*
107255 ** Perform a shift action.
@@ -107595,66 +107686,94 @@
107686 ** { ... } // User supplied code
107687 ** #line <lineno> <thisfile>
107688 ** break;
107689 */
107690 case 5: /* explain ::= */
107691 #line 107 "parse.y"
107692 { sqlite3BeginParse(pParse, 0); }
107693 #line 2107 "parse.c"
107694 break;
107695 case 6: /* explain ::= EXPLAIN */
107696 #line 109 "parse.y"
107697 { sqlite3BeginParse(pParse, 1); }
107698 #line 2112 "parse.c"
107699 break;
107700 case 7: /* explain ::= EXPLAIN QUERY PLAN */
107701 #line 110 "parse.y"
107702 { sqlite3BeginParse(pParse, 2); }
107703 #line 2117 "parse.c"
107704 break;
107705 case 8: /* cmdx ::= cmd */
107706 #line 112 "parse.y"
107707 { sqlite3FinishCoding(pParse); }
107708 #line 2122 "parse.c"
107709 break;
107710 case 9: /* cmd ::= BEGIN transtype trans_opt */
107711 #line 117 "parse.y"
107712 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
107713 #line 2127 "parse.c"
107714 break;
107715 case 13: /* transtype ::= */
107716 #line 122 "parse.y"
107717 {yygotominor.yy4 = TK_DEFERRED;}
107718 #line 2132 "parse.c"
107719 break;
107720 case 14: /* transtype ::= DEFERRED */
107721 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
107722 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
107723 case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
107724 case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
107725 #line 123 "parse.y"
107726 {yygotominor.yy4 = yymsp[0].major;}
107727 #line 2141 "parse.c"
107728 break;
107729 case 17: /* cmd ::= COMMIT trans_opt */
107730 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
107731 #line 126 "parse.y"
107732 {sqlite3CommitTransaction(pParse);}
107733 #line 2147 "parse.c"
107734 break;
107735 case 19: /* cmd ::= ROLLBACK trans_opt */
107736 #line 128 "parse.y"
107737 {sqlite3RollbackTransaction(pParse);}
107738 #line 2152 "parse.c"
107739 break;
107740 case 22: /* cmd ::= SAVEPOINT nm */
107741 #line 132 "parse.y"
107742 {
107743 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
107744 }
107745 #line 2159 "parse.c"
107746 break;
107747 case 23: /* cmd ::= RELEASE savepoint_opt nm */
107748 #line 135 "parse.y"
107749 {
107750 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
107751 }
107752 #line 2166 "parse.c"
107753 break;
107754 case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
107755 #line 138 "parse.y"
107756 {
107757 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
107758 }
107759 #line 2173 "parse.c"
107760 break;
107761 case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
107762 #line 145 "parse.y"
107763 {
107764 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
107765 }
107766 #line 2180 "parse.c"
107767 break;
107768 case 27: /* createkw ::= CREATE */
107769 #line 148 "parse.y"
107770 {
107771 pParse->db->lookaside.bEnabled = 0;
107772 yygotominor.yy0 = yymsp[0].minor.yy0;
107773 }
107774 #line 2188 "parse.c"
107775 break;
107776 case 28: /* ifnotexists ::= */
107777 case 31: /* temp ::= */ yytestcase(yyruleno==31);
107778 case 70: /* autoinc ::= */ yytestcase(yyruleno==70);
107779 case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==83);
@@ -107664,44 +107783,56 @@
107783 case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
107784 case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
107785 case 121: /* distinct ::= */ yytestcase(yyruleno==121);
107786 case 222: /* between_op ::= BETWEEN */ yytestcase(yyruleno==222);
107787 case 225: /* in_op ::= IN */ yytestcase(yyruleno==225);
107788 #line 153 "parse.y"
107789 {yygotominor.yy4 = 0;}
107790 #line 2204 "parse.c"
107791 break;
107792 case 29: /* ifnotexists ::= IF NOT EXISTS */
107793 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
107794 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
107795 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
107796 case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
107797 case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
107798 case 223: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==223);
107799 case 226: /* in_op ::= NOT IN */ yytestcase(yyruleno==226);
107800 #line 154 "parse.y"
107801 {yygotominor.yy4 = 1;}
107802 #line 2216 "parse.c"
107803 break;
107804 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
107805 #line 160 "parse.y"
107806 {
107807 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
107808 }
107809 #line 2223 "parse.c"
107810 break;
107811 case 33: /* create_table_args ::= AS select */
107812 #line 163 "parse.y"
107813 {
107814 sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy387);
107815 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
107816 }
107817 #line 2231 "parse.c"
107818 break;
107819 case 36: /* column ::= columnid type carglist */
107820 #line 175 "parse.y"
107821 {
107822 yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
107823 yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n;
107824 }
107825 #line 2239 "parse.c"
107826 break;
107827 case 37: /* columnid ::= nm */
107828 #line 179 "parse.y"
107829 {
107830 sqlite3AddColumn(pParse,&yymsp[0].minor.yy0);
107831 yygotominor.yy0 = yymsp[0].minor.yy0;
107832 }
107833 #line 2247 "parse.c"
107834 break;
107835 case 38: /* id ::= ID */
107836 case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39);
107837 case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40);
107838 case 41: /* nm ::= id */ yytestcase(yyruleno==41);
@@ -107721,256 +107852,373 @@
107852 case 264: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==264);
107853 case 265: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==265);
107854 case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
107855 case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
107856 case 285: /* trnm ::= nm */ yytestcase(yyruleno==285);
107857 #line 189 "parse.y"
107858 {yygotominor.yy0 = yymsp[0].minor.yy0;}
107859 #line 2273 "parse.c"
107860 break;
107861 case 45: /* type ::= typetoken */
107862 #line 251 "parse.y"
107863 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
107864 #line 2278 "parse.c"
107865 break;
107866 case 47: /* typetoken ::= typename LP signed RP */
107867 #line 253 "parse.y"
107868 {
107869 yygotominor.yy0.z = yymsp[-3].minor.yy0.z;
107870 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
107871 }
107872 #line 2286 "parse.c"
107873 break;
107874 case 48: /* typetoken ::= typename LP signed COMMA signed RP */
107875 #line 257 "parse.y"
107876 {
107877 yygotominor.yy0.z = yymsp[-5].minor.yy0.z;
107878 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
107879 }
107880 #line 2294 "parse.c"
107881 break;
107882 case 50: /* typename ::= typename ids */
107883 #line 263 "parse.y"
107884 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
107885 #line 2299 "parse.c"
107886 break;
107887 case 57: /* ccons ::= DEFAULT term */
107888 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
107889 #line 274 "parse.y"
107890 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy118);}
107891 #line 2305 "parse.c"
107892 break;
107893 case 58: /* ccons ::= DEFAULT LP expr RP */
107894 #line 275 "parse.y"
107895 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy118);}
107896 #line 2310 "parse.c"
107897 break;
107898 case 60: /* ccons ::= DEFAULT MINUS term */
107899 #line 277 "parse.y"
107900 {
107901 ExprSpan v;
107902 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy118.pExpr, 0, 0);
107903 v.zStart = yymsp[-1].minor.yy0.z;
107904 v.zEnd = yymsp[0].minor.yy118.zEnd;
107905 sqlite3AddDefaultValue(pParse,&v);
107906 }
107907 #line 2321 "parse.c"
107908 break;
107909 case 61: /* ccons ::= DEFAULT id */
107910 #line 284 "parse.y"
107911 {
107912 ExprSpan v;
107913 spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
107914 sqlite3AddDefaultValue(pParse,&v);
107915 }
107916 #line 2330 "parse.c"
107917 break;
107918 case 63: /* ccons ::= NOT NULL onconf */
107919 #line 294 "parse.y"
107920 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
107921 #line 2335 "parse.c"
107922 break;
107923 case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
107924 #line 296 "parse.y"
107925 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
107926 #line 2340 "parse.c"
107927 break;
107928 case 65: /* ccons ::= UNIQUE onconf */
107929 #line 297 "parse.y"
107930 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0);}
107931 #line 2345 "parse.c"
107932 break;
107933 case 66: /* ccons ::= CHECK LP expr RP */
107934 #line 298 "parse.y"
107935 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy118.pExpr);}
107936 #line 2350 "parse.c"
107937 break;
107938 case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
107939 #line 300 "parse.y"
107940 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
107941 #line 2355 "parse.c"
107942 break;
107943 case 68: /* ccons ::= defer_subclause */
107944 #line 301 "parse.y"
107945 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
107946 #line 2360 "parse.c"
107947 break;
107948 case 69: /* ccons ::= COLLATE ids */
107949 #line 302 "parse.y"
107950 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
107951 #line 2365 "parse.c"
107952 break;
107953 case 72: /* refargs ::= */
107954 #line 315 "parse.y"
107955 { yygotominor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
107956 #line 2370 "parse.c"
107957 break;
107958 case 73: /* refargs ::= refargs refarg */
107959 #line 316 "parse.y"
107960 { yygotominor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
107961 #line 2375 "parse.c"
107962 break;
107963 case 74: /* refarg ::= MATCH nm */
107964 case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
107965 #line 318 "parse.y"
107966 { yygotominor.yy215.value = 0; yygotominor.yy215.mask = 0x000000; }
107967 #line 2381 "parse.c"
107968 break;
107969 case 76: /* refarg ::= ON DELETE refact */
107970 #line 320 "parse.y"
107971 { yygotominor.yy215.value = yymsp[0].minor.yy4; yygotominor.yy215.mask = 0x0000ff; }
107972 #line 2386 "parse.c"
107973 break;
107974 case 77: /* refarg ::= ON UPDATE refact */
107975 #line 321 "parse.y"
107976 { yygotominor.yy215.value = yymsp[0].minor.yy4<<8; yygotominor.yy215.mask = 0x00ff00; }
107977 #line 2391 "parse.c"
107978 break;
107979 case 78: /* refact ::= SET NULL */
107980 #line 323 "parse.y"
107981 { yygotominor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
107982 #line 2396 "parse.c"
107983 break;
107984 case 79: /* refact ::= SET DEFAULT */
107985 #line 324 "parse.y"
107986 { yygotominor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
107987 #line 2401 "parse.c"
107988 break;
107989 case 80: /* refact ::= CASCADE */
107990 #line 325 "parse.y"
107991 { yygotominor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
107992 #line 2406 "parse.c"
107993 break;
107994 case 81: /* refact ::= RESTRICT */
107995 #line 326 "parse.y"
107996 { yygotominor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
107997 #line 2411 "parse.c"
107998 break;
107999 case 82: /* refact ::= NO ACTION */
108000 #line 327 "parse.y"
108001 { yygotominor.yy4 = OE_None; /* EV: R-33326-45252 */}
108002 #line 2416 "parse.c"
108003 break;
108004 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
108005 case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
108006 case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
108007 case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
108008 #line 330 "parse.y"
108009 {yygotominor.yy4 = yymsp[0].minor.yy4;}
108010 #line 2424 "parse.c"
108011 break;
108012 case 88: /* conslist_opt ::= */
108013 #line 339 "parse.y"
108014 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
108015 #line 2429 "parse.c"
108016 break;
108017 case 89: /* conslist_opt ::= COMMA conslist */
108018 #line 340 "parse.y"
108019 {yygotominor.yy0 = yymsp[-1].minor.yy0;}
108020 #line 2434 "parse.c"
108021 break;
108022 case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
108023 #line 346 "parse.y"
108024 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
108025 #line 2439 "parse.c"
108026 break;
108027 case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
108028 #line 348 "parse.y"
108029 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0);}
108030 #line 2444 "parse.c"
108031 break;
108032 case 96: /* tcons ::= CHECK LP expr RP onconf */
108033 #line 350 "parse.y"
108034 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy118.pExpr);}
108035 #line 2449 "parse.c"
108036 break;
108037 case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
108038 #line 352 "parse.y"
108039 {
108040 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
108041 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
108042 }
108043 #line 2457 "parse.c"
108044 break;
108045 case 100: /* onconf ::= */
108046 #line 366 "parse.y"
108047 {yygotominor.yy4 = OE_Default;}
108048 #line 2462 "parse.c"
108049 break;
108050 case 102: /* orconf ::= */
108051 #line 368 "parse.y"
108052 {yygotominor.yy210 = OE_Default;}
108053 #line 2467 "parse.c"
108054 break;
108055 case 103: /* orconf ::= OR resolvetype */
108056 #line 369 "parse.y"
108057 {yygotominor.yy210 = (u8)yymsp[0].minor.yy4;}
108058 #line 2472 "parse.c"
108059 break;
108060 case 105: /* resolvetype ::= IGNORE */
108061 #line 371 "parse.y"
108062 {yygotominor.yy4 = OE_Ignore;}
108063 #line 2477 "parse.c"
108064 break;
108065 case 106: /* resolvetype ::= REPLACE */
108066 #line 372 "parse.y"
108067 {yygotominor.yy4 = OE_Replace;}
108068 #line 2482 "parse.c"
108069 break;
108070 case 107: /* cmd ::= DROP TABLE ifexists fullname */
108071 #line 376 "parse.y"
108072 {
108073 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
108074 }
108075 #line 2489 "parse.c"
108076 break;
108077 case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
108078 #line 386 "parse.y"
108079 {
108080 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy387, yymsp[-6].minor.yy4, yymsp[-4].minor.yy4);
108081 }
108082 #line 2496 "parse.c"
108083 break;
108084 case 111: /* cmd ::= DROP VIEW ifexists fullname */
108085 #line 389 "parse.y"
108086 {
108087 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
108088 }
108089 #line 2503 "parse.c"
108090 break;
108091 case 112: /* cmd ::= select */
108092 #line 396 "parse.y"
108093 {
108094 SelectDest dest = {SRT_Output, 0, 0, 0, 0};
108095 sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
108096 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
108097 }
108098 #line 2512 "parse.c"
108099 break;
108100 case 113: /* select ::= oneselect */
108101 #line 407 "parse.y"
108102 {yygotominor.yy387 = yymsp[0].minor.yy387;}
108103 #line 2517 "parse.c"
108104 break;
108105 case 114: /* select ::= select multiselect_op oneselect */
108106 #line 409 "parse.y"
108107 {
108108 if( yymsp[0].minor.yy387 ){
108109 yymsp[0].minor.yy387->op = (u8)yymsp[-1].minor.yy4;
108110 yymsp[0].minor.yy387->pPrior = yymsp[-2].minor.yy387;
108111 }else{
108112 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy387);
108113 }
108114 yygotominor.yy387 = yymsp[0].minor.yy387;
108115 }
108116 #line 2530 "parse.c"
108117 break;
108118 case 116: /* multiselect_op ::= UNION ALL */
108119 #line 420 "parse.y"
108120 {yygotominor.yy4 = TK_ALL;}
108121 #line 2535 "parse.c"
108122 break;
108123 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
108124 #line 424 "parse.y"
108125 {
108126 yygotominor.yy387 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy259,yymsp[-4].minor.yy314,yymsp[-3].minor.yy322,yymsp[-2].minor.yy314,yymsp[-1].minor.yy322,yymsp[-7].minor.yy4,yymsp[0].minor.yy292.pLimit,yymsp[0].minor.yy292.pOffset);
108127 }
108128 #line 2542 "parse.c"
108129 break;
108130 case 122: /* sclp ::= selcollist COMMA */
108131 case 247: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==247);
108132 #line 445 "parse.y"
108133 {yygotominor.yy322 = yymsp[-1].minor.yy322;}
108134 #line 2548 "parse.c"
108135 break;
108136 case 123: /* sclp ::= */
108137 case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
108138 case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159);
108139 case 240: /* exprlist ::= */ yytestcase(yyruleno==240);
108140 case 246: /* idxlist_opt ::= */ yytestcase(yyruleno==246);
108141 #line 446 "parse.y"
108142 {yygotominor.yy322 = 0;}
108143 #line 2557 "parse.c"
108144 break;
108145 case 124: /* selcollist ::= sclp expr as */
108146 #line 447 "parse.y"
108147 {
108148 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, yymsp[-1].minor.yy118.pExpr);
108149 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[0].minor.yy0, 1);
108150 sqlite3ExprListSetSpan(pParse,yygotominor.yy322,&yymsp[-1].minor.yy118);
108151 }
108152 #line 2566 "parse.c"
108153 break;
108154 case 125: /* selcollist ::= sclp STAR */
108155 #line 452 "parse.y"
108156 {
108157 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
108158 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy322, p);
108159 }
108160 #line 2574 "parse.c"
108161 break;
108162 case 126: /* selcollist ::= sclp nm DOT STAR */
108163 #line 456 "parse.y"
108164 {
108165 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
108166 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108167 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
108168 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, pDot);
108169 }
108170 #line 2584 "parse.c"
108171 break;
108172 case 129: /* as ::= */
108173 #line 469 "parse.y"
108174 {yygotominor.yy0.n = 0;}
108175 #line 2589 "parse.c"
108176 break;
108177 case 130: /* from ::= */
108178 #line 481 "parse.y"
108179 {yygotominor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy259));}
108180 #line 2594 "parse.c"
108181 break;
108182 case 131: /* from ::= FROM seltablist */
108183 #line 482 "parse.y"
108184 {
108185 yygotominor.yy259 = yymsp[0].minor.yy259;
108186 sqlite3SrcListShiftJoinType(yygotominor.yy259);
108187 }
108188 #line 2602 "parse.c"
108189 break;
108190 case 132: /* stl_prefix ::= seltablist joinop */
108191 #line 490 "parse.y"
108192 {
108193 yygotominor.yy259 = yymsp[-1].minor.yy259;
108194 if( ALWAYS(yygotominor.yy259 && yygotominor.yy259->nSrc>0) ) yygotominor.yy259->a[yygotominor.yy259->nSrc-1].jointype = (u8)yymsp[0].minor.yy4;
108195 }
108196 #line 2610 "parse.c"
108197 break;
108198 case 133: /* stl_prefix ::= */
108199 #line 494 "parse.y"
108200 {yygotominor.yy259 = 0;}
108201 #line 2615 "parse.c"
108202 break;
108203 case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
108204 #line 495 "parse.y"
108205 {
108206 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
108207 sqlite3SrcListIndexedBy(pParse, yygotominor.yy259, &yymsp[-2].minor.yy0);
108208 }
108209 #line 2623 "parse.c"
108210 break;
108211 case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
108212 #line 501 "parse.y"
108213 {
108214 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy387,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
108215 }
108216 #line 2630 "parse.c"
108217 break;
108218 case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
108219 #line 505 "parse.y"
108220 {
108221 if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
108222 yygotominor.yy259 = yymsp[-4].minor.yy259;
108223 }else{
108224 Select *pSubquery;
@@ -107977,180 +108225,260 @@
108225 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
108226 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,0,0,0);
108227 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
108228 }
108229 }
108230 #line 2644 "parse.c"
108231 break;
108232 case 137: /* dbnm ::= */
108233 case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
108234 #line 530 "parse.y"
108235 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
108236 #line 2650 "parse.c"
108237 break;
108238 case 139: /* fullname ::= nm dbnm */
108239 #line 535 "parse.y"
108240 {yygotominor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
108241 #line 2655 "parse.c"
108242 break;
108243 case 140: /* joinop ::= COMMA|JOIN */
108244 #line 539 "parse.y"
108245 { yygotominor.yy4 = JT_INNER; }
108246 #line 2660 "parse.c"
108247 break;
108248 case 141: /* joinop ::= JOIN_KW JOIN */
108249 #line 540 "parse.y"
108250 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
108251 #line 2665 "parse.c"
108252 break;
108253 case 142: /* joinop ::= JOIN_KW nm JOIN */
108254 #line 541 "parse.y"
108255 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
108256 #line 2670 "parse.c"
108257 break;
108258 case 143: /* joinop ::= JOIN_KW nm nm JOIN */
108259 #line 543 "parse.y"
108260 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
108261 #line 2675 "parse.c"
108262 break;
108263 case 144: /* on_opt ::= ON expr */
108264 case 155: /* sortitem ::= expr */ yytestcase(yyruleno==155);
108265 case 162: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==162);
108266 case 169: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==169);
108267 case 235: /* case_else ::= ELSE expr */ yytestcase(yyruleno==235);
108268 case 237: /* case_operand ::= expr */ yytestcase(yyruleno==237);
108269 #line 547 "parse.y"
108270 {yygotominor.yy314 = yymsp[0].minor.yy118.pExpr;}
108271 #line 2685 "parse.c"
108272 break;
108273 case 145: /* on_opt ::= */
108274 case 161: /* having_opt ::= */ yytestcase(yyruleno==161);
108275 case 168: /* where_opt ::= */ yytestcase(yyruleno==168);
108276 case 236: /* case_else ::= */ yytestcase(yyruleno==236);
108277 case 238: /* case_operand ::= */ yytestcase(yyruleno==238);
108278 #line 548 "parse.y"
108279 {yygotominor.yy314 = 0;}
108280 #line 2694 "parse.c"
108281 break;
108282 case 148: /* indexed_opt ::= NOT INDEXED */
108283 #line 563 "parse.y"
108284 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
108285 #line 2699 "parse.c"
108286 break;
108287 case 149: /* using_opt ::= USING LP inscollist RP */
108288 case 181: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==181);
108289 #line 567 "parse.y"
108290 {yygotominor.yy384 = yymsp[-1].minor.yy384;}
108291 #line 2705 "parse.c"
108292 break;
108293 case 150: /* using_opt ::= */
108294 case 180: /* inscollist_opt ::= */ yytestcase(yyruleno==180);
108295 #line 568 "parse.y"
108296 {yygotominor.yy384 = 0;}
108297 #line 2711 "parse.c"
108298 break;
108299 case 152: /* orderby_opt ::= ORDER BY sortlist */
108300 case 160: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==160);
108301 case 239: /* exprlist ::= nexprlist */ yytestcase(yyruleno==239);
108302 #line 579 "parse.y"
108303 {yygotominor.yy322 = yymsp[0].minor.yy322;}
108304 #line 2718 "parse.c"
108305 break;
108306 case 153: /* sortlist ::= sortlist COMMA sortitem sortorder */
108307 #line 580 "parse.y"
108308 {
108309 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
108310 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108311 }
108312 #line 2726 "parse.c"
108313 break;
108314 case 154: /* sortlist ::= sortitem sortorder */
108315 #line 584 "parse.y"
108316 {
108317 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314);
108318 if( yygotominor.yy322 && ALWAYS(yygotominor.yy322->a) ) yygotominor.yy322->a[0].sortOrder = (u8)yymsp[0].minor.yy4;
108319 }
108320 #line 2734 "parse.c"
108321 break;
108322 case 156: /* sortorder ::= ASC */
108323 case 158: /* sortorder ::= */ yytestcase(yyruleno==158);
108324 #line 592 "parse.y"
108325 {yygotominor.yy4 = SQLITE_SO_ASC;}
108326 #line 2740 "parse.c"
108327 break;
108328 case 157: /* sortorder ::= DESC */
108329 #line 593 "parse.y"
108330 {yygotominor.yy4 = SQLITE_SO_DESC;}
108331 #line 2745 "parse.c"
108332 break;
108333 case 163: /* limit_opt ::= */
108334 #line 619 "parse.y"
108335 {yygotominor.yy292.pLimit = 0; yygotominor.yy292.pOffset = 0;}
108336 #line 2750 "parse.c"
108337 break;
108338 case 164: /* limit_opt ::= LIMIT expr */
108339 #line 620 "parse.y"
108340 {yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr; yygotominor.yy292.pOffset = 0;}
108341 #line 2755 "parse.c"
108342 break;
108343 case 165: /* limit_opt ::= LIMIT expr OFFSET expr */
108344 #line 622 "parse.y"
108345 {yygotominor.yy292.pLimit = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pOffset = yymsp[0].minor.yy118.pExpr;}
108346 #line 2760 "parse.c"
108347 break;
108348 case 166: /* limit_opt ::= LIMIT expr COMMA expr */
108349 #line 624 "parse.y"
108350 {yygotominor.yy292.pOffset = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr;}
108351 #line 2765 "parse.c"
108352 break;
108353 case 167: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
108354 #line 637 "parse.y"
108355 {
108356 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
108357 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314);
108358 }
108359 #line 2773 "parse.c"
108360 break;
108361 case 170: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
108362 #line 660 "parse.y"
108363 {
108364 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
108365 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
108366 sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy210);
108367 }
108368 #line 2782 "parse.c"
108369 break;
108370 case 171: /* setlist ::= setlist COMMA nm EQ expr */
108371 #line 670 "parse.y"
108372 {
108373 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy118.pExpr);
108374 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108375 }
108376 #line 2790 "parse.c"
108377 break;
108378 case 172: /* setlist ::= nm EQ expr */
108379 #line 674 "parse.y"
108380 {
108381 yygotominor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy118.pExpr);
108382 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108383 }
108384 #line 2798 "parse.c"
108385 break;
108386 case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
108387 #line 683 "parse.y"
108388 {sqlite3Insert(pParse, yymsp[-5].minor.yy259, yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy384, yymsp[-7].minor.yy210);}
108389 #line 2803 "parse.c"
108390 break;
108391 case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
108392 #line 685 "parse.y"
108393 {sqlite3Insert(pParse, yymsp[-2].minor.yy259, 0, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy210);}
108394 #line 2808 "parse.c"
108395 break;
108396 case 175: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
108397 #line 687 "parse.y"
108398 {sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy210);}
108399 #line 2813 "parse.c"
108400 break;
108401 case 176: /* insert_cmd ::= INSERT orconf */
108402 #line 690 "parse.y"
108403 {yygotominor.yy210 = yymsp[0].minor.yy210;}
108404 #line 2818 "parse.c"
108405 break;
108406 case 177: /* insert_cmd ::= REPLACE */
108407 #line 691 "parse.y"
108408 {yygotominor.yy210 = OE_Replace;}
108409 #line 2823 "parse.c"
108410 break;
108411 case 178: /* itemlist ::= itemlist COMMA expr */
108412 case 241: /* nexprlist ::= nexprlist COMMA expr */ yytestcase(yyruleno==241);
108413 #line 698 "parse.y"
108414 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy118.pExpr);}
108415 #line 2829 "parse.c"
108416 break;
108417 case 179: /* itemlist ::= expr */
108418 case 242: /* nexprlist ::= expr */ yytestcase(yyruleno==242);
108419 #line 700 "parse.y"
108420 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy118.pExpr);}
108421 #line 2835 "parse.c"
108422 break;
108423 case 182: /* inscollist ::= inscollist COMMA nm */
108424 #line 710 "parse.y"
108425 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
108426 #line 2840 "parse.c"
108427 break;
108428 case 183: /* inscollist ::= nm */
108429 #line 712 "parse.y"
108430 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
108431 #line 2845 "parse.c"
108432 break;
108433 case 184: /* expr ::= term */
108434 #line 743 "parse.y"
108435 {yygotominor.yy118 = yymsp[0].minor.yy118;}
108436 #line 2850 "parse.c"
108437 break;
108438 case 185: /* expr ::= LP expr RP */
108439 #line 744 "parse.y"
108440 {yygotominor.yy118.pExpr = yymsp[-1].minor.yy118.pExpr; spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
108441 #line 2855 "parse.c"
108442 break;
108443 case 186: /* term ::= NULL */
108444 case 191: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==191);
108445 case 192: /* term ::= STRING */ yytestcase(yyruleno==192);
108446 #line 745 "parse.y"
108447 {spanExpr(&yygotominor.yy118, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
108448 #line 2862 "parse.c"
108449 break;
108450 case 187: /* expr ::= id */
108451 case 188: /* expr ::= JOIN_KW */ yytestcase(yyruleno==188);
108452 #line 746 "parse.y"
108453 {spanExpr(&yygotominor.yy118, pParse, TK_ID, &yymsp[0].minor.yy0);}
108454 #line 2868 "parse.c"
108455 break;
108456 case 189: /* expr ::= nm DOT nm */
108457 #line 748 "parse.y"
108458 {
108459 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108460 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108461 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
108462 spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
108463 }
108464 #line 2878 "parse.c"
108465 break;
108466 case 190: /* expr ::= nm DOT nm DOT nm */
108467 #line 754 "parse.y"
108468 {
108469 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
108470 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
108471 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
108472 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
108473 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
108474 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108475 }
108476 #line 2890 "parse.c"
108477 break;
108478 case 193: /* expr ::= REGISTER */
108479 #line 764 "parse.y"
108480 {
108481 /* When doing a nested parse, one can include terms in an expression
108482 ** that look like this: #1 #2 ... These terms refer to registers
108483 ** in the virtual machine. #N is the N-th register. */
108484 if( pParse->nested==0 ){
@@ -108160,32 +108488,40 @@
108488 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
108489 if( yygotominor.yy118.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy118.pExpr->iTable);
108490 }
108491 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108492 }
108493 #line 2907 "parse.c"
108494 break;
108495 case 194: /* expr ::= VARIABLE */
108496 #line 777 "parse.y"
108497 {
108498 spanExpr(&yygotominor.yy118, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
108499 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy118.pExpr);
108500 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108501 }
108502 #line 2916 "parse.c"
108503 break;
108504 case 195: /* expr ::= expr COLLATE ids */
108505 #line 782 "parse.y"
108506 {
108507 yygotominor.yy118.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy118.pExpr, &yymsp[0].minor.yy0);
108508 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108509 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108510 }
108511 #line 2925 "parse.c"
108512 break;
108513 case 196: /* expr ::= CAST LP expr AS typetoken RP */
108514 #line 788 "parse.y"
108515 {
108516 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy118.pExpr, 0, &yymsp[-1].minor.yy0);
108517 spanSet(&yygotominor.yy118,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
108518 }
108519 #line 2933 "parse.c"
108520 break;
108521 case 197: /* expr ::= ID LP distinct exprlist RP */
108522 #line 793 "parse.y"
108523 {
108524 if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
108525 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
108526 }
108527 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
@@ -108192,47 +108528,59 @@
108528 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
108529 if( yymsp[-2].minor.yy4 && yygotominor.yy118.pExpr ){
108530 yygotominor.yy118.pExpr->flags |= EP_Distinct;
108531 }
108532 }
108533 #line 2947 "parse.c"
108534 break;
108535 case 198: /* expr ::= ID LP STAR RP */
108536 #line 803 "parse.y"
108537 {
108538 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
108539 spanSet(&yygotominor.yy118,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
108540 }
108541 #line 2955 "parse.c"
108542 break;
108543 case 199: /* term ::= CTIME_KW */
108544 #line 807 "parse.y"
108545 {
108546 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
108547 ** treated as functions that return constants */
108548 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
108549 if( yygotominor.yy118.pExpr ){
108550 yygotominor.yy118.pExpr->op = TK_CONST_FUNC;
108551 }
108552 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
108553 }
108554 #line 2968 "parse.c"
108555 break;
108556 case 200: /* expr ::= expr AND expr */
108557 case 201: /* expr ::= expr OR expr */ yytestcase(yyruleno==201);
108558 case 202: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==202);
108559 case 203: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==203);
108560 case 204: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==204);
108561 case 205: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==205);
108562 case 206: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==206);
108563 case 207: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==207);
108564 #line 834 "parse.y"
108565 {spanBinaryExpr(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);}
108566 #line 2980 "parse.c"
108567 break;
108568 case 208: /* likeop ::= LIKE_KW */
108569 case 210: /* likeop ::= MATCH */ yytestcase(yyruleno==210);
108570 #line 847 "parse.y"
108571 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 0;}
108572 #line 2986 "parse.c"
108573 break;
108574 case 209: /* likeop ::= NOT LIKE_KW */
108575 case 211: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==211);
108576 #line 848 "parse.y"
108577 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 1;}
108578 #line 2992 "parse.c"
108579 break;
108580 case 212: /* expr ::= expr likeop expr */
108581 #line 851 "parse.y"
108582 {
108583 ExprList *pList;
108584 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy118.pExpr);
108585 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy118.pExpr);
108586 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy342.eOperator);
@@ -108239,12 +108587,14 @@
108587 if( yymsp[-1].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108588 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
108589 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108590 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108591 }
108592 #line 3006 "parse.c"
108593 break;
108594 case 213: /* expr ::= expr likeop expr ESCAPE expr */
108595 #line 861 "parse.y"
108596 {
108597 ExprList *pList;
108598 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108599 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy118.pExpr);
108600 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
@@ -108252,40 +108602,56 @@
108602 if( yymsp[-3].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108603 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108604 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108605 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
108606 }
108607 #line 3021 "parse.c"
108608 break;
108609 case 214: /* expr ::= expr ISNULL|NOTNULL */
108610 #line 889 "parse.y"
108611 {spanUnaryPostfix(&yygotominor.yy118,pParse,yymsp[0].major,&yymsp[-1].minor.yy118,&yymsp[0].minor.yy0);}
108612 #line 3026 "parse.c"
108613 break;
108614 case 215: /* expr ::= expr NOT NULL */
108615 #line 890 "parse.y"
108616 {spanUnaryPostfix(&yygotominor.yy118,pParse,TK_NOTNULL,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy0);}
108617 #line 3031 "parse.c"
108618 break;
108619 case 216: /* expr ::= expr IS expr */
108620 #line 911 "parse.y"
108621 {
108622 spanBinaryExpr(&yygotominor.yy118,pParse,TK_IS,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);
108623 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_ISNULL);
108624 }
108625 #line 3039 "parse.c"
108626 break;
108627 case 217: /* expr ::= expr IS NOT expr */
108628 #line 915 "parse.y"
108629 {
108630 spanBinaryExpr(&yygotominor.yy118,pParse,TK_ISNOT,&yymsp[-3].minor.yy118,&yymsp[0].minor.yy118);
108631 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_NOTNULL);
108632 }
108633 #line 3047 "parse.c"
108634 break;
108635 case 218: /* expr ::= NOT expr */
108636 case 219: /* expr ::= BITNOT expr */ yytestcase(yyruleno==219);
108637 #line 938 "parse.y"
108638 {spanUnaryPrefix(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108639 #line 3053 "parse.c"
108640 break;
108641 case 220: /* expr ::= MINUS expr */
108642 #line 941 "parse.y"
108643 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UMINUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108644 #line 3058 "parse.c"
108645 break;
108646 case 221: /* expr ::= PLUS expr */
108647 #line 943 "parse.y"
108648 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UPLUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
108649 #line 3063 "parse.c"
108650 break;
108651 case 224: /* expr ::= expr between_op expr AND expr */
108652 #line 948 "parse.y"
108653 {
108654 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108655 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
108656 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108657 if( yygotominor.yy118.pExpr ){
@@ -108295,12 +108661,14 @@
108661 }
108662 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108663 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108664 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
108665 }
108666 #line 3080 "parse.c"
108667 break;
108668 case 227: /* expr ::= expr in_op LP exprlist RP */
108669 #line 965 "parse.y"
108670 {
108671 if( yymsp[-1].minor.yy322==0 ){
108672 /* Expressions of the form
108673 **
108674 ** expr1 IN ()
@@ -108322,12 +108690,14 @@
108690 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108691 }
108692 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108693 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108694 }
108695 #line 3109 "parse.c"
108696 break;
108697 case 228: /* expr ::= LP select RP */
108698 #line 990 "parse.y"
108699 {
108700 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
108701 if( yygotominor.yy118.pExpr ){
108702 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108703 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108336,12 +108706,14 @@
108706 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108707 }
108708 yygotominor.yy118.zStart = yymsp[-2].minor.yy0.z;
108709 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108710 }
108711 #line 3125 "parse.c"
108712 break;
108713 case 229: /* expr ::= expr in_op LP select RP */
108714 #line 1002 "parse.y"
108715 {
108716 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
108717 if( yygotominor.yy118.pExpr ){
108718 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
108719 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
@@ -108351,12 +108723,14 @@
108723 }
108724 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108725 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
108726 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108727 }
108728 #line 3142 "parse.c"
108729 break;
108730 case 230: /* expr ::= expr in_op nm dbnm */
108731 #line 1015 "parse.y"
108732 {
108733 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
108734 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy118.pExpr, 0, 0);
108735 if( yygotominor.yy118.pExpr ){
108736 yygotominor.yy118.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
@@ -108367,12 +108741,14 @@
108741 }
108742 if( yymsp[-2].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
108743 yygotominor.yy118.zStart = yymsp[-3].minor.yy118.zStart;
108744 yygotominor.yy118.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
108745 }
108746 #line 3160 "parse.c"
108747 break;
108748 case 231: /* expr ::= EXISTS LP select RP */
108749 #line 1029 "parse.y"
108750 {
108751 Expr *p = yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
108752 if( p ){
108753 p->x.pSelect = yymsp[-1].minor.yy387;
108754 ExprSetProperty(p, EP_xIsSelect);
@@ -108381,12 +108757,14 @@
108757 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
108758 }
108759 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
108760 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108761 }
108762 #line 3176 "parse.c"
108763 break;
108764 case 232: /* expr ::= CASE case_operand case_exprlist case_else END */
108765 #line 1044 "parse.y"
108766 {
108767 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, 0);
108768 if( yygotominor.yy118.pExpr ){
108769 yygotominor.yy118.pExpr->x.pList = yymsp[-2].minor.yy322;
108770 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
@@ -108394,38 +108772,50 @@
108772 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
108773 }
108774 yygotominor.yy118.zStart = yymsp[-4].minor.yy0.z;
108775 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
108776 }
108777 #line 3191 "parse.c"
108778 break;
108779 case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
108780 #line 1057 "parse.y"
108781 {
108782 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy118.pExpr);
108783 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108784 }
108785 #line 3199 "parse.c"
108786 break;
108787 case 234: /* case_exprlist ::= WHEN expr THEN expr */
108788 #line 1061 "parse.y"
108789 {
108790 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
108791 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
108792 }
108793 #line 3207 "parse.c"
108794 break;
108795 case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
108796 #line 1090 "parse.y"
108797 {
108798 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
108799 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy322, yymsp[-9].minor.yy4,
108800 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy4);
108801 }
108802 #line 3216 "parse.c"
108803 break;
108804 case 244: /* uniqueflag ::= UNIQUE */
108805 case 298: /* raisetype ::= ABORT */ yytestcase(yyruleno==298);
108806 #line 1097 "parse.y"
108807 {yygotominor.yy4 = OE_Abort;}
108808 #line 3222 "parse.c"
108809 break;
108810 case 245: /* uniqueflag ::= */
108811 #line 1098 "parse.y"
108812 {yygotominor.yy4 = OE_None;}
108813 #line 3227 "parse.c"
108814 break;
108815 case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */
108816 #line 1107 "parse.y"
108817 {
108818 Expr *p = 0;
108819 if( yymsp[-1].minor.yy0.n>0 ){
108820 p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
108821 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108433,12 +108823,14 @@
108823 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, p);
108824 sqlite3ExprListSetName(pParse,yygotominor.yy322,&yymsp[-2].minor.yy0,1);
108825 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108826 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108827 }
108828 #line 3242 "parse.c"
108829 break;
108830 case 249: /* idxlist ::= nm collate sortorder */
108831 #line 1118 "parse.y"
108832 {
108833 Expr *p = 0;
108834 if( yymsp[-1].minor.yy0.n>0 ){
108835 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
108836 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
@@ -108446,214 +108838,307 @@
108838 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, p);
108839 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
108840 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
108841 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
108842 }
108843 #line 3257 "parse.c"
108844 break;
108845 case 250: /* collate ::= */
108846 #line 1131 "parse.y"
108847 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
108848 #line 3262 "parse.c"
108849 break;
108850 case 252: /* cmd ::= DROP INDEX ifexists fullname */
108851 #line 1137 "parse.y"
108852 {sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
108853 #line 3267 "parse.c"
108854 break;
108855 case 253: /* cmd ::= VACUUM */
108856 case 254: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==254);
108857 #line 1143 "parse.y"
108858 {sqlite3Vacuum(pParse);}
108859 #line 3273 "parse.c"
108860 break;
108861 case 255: /* cmd ::= PRAGMA nm dbnm */
108862 #line 1151 "parse.y"
108863 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
108864 #line 3278 "parse.c"
108865 break;
108866 case 256: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
108867 #line 1152 "parse.y"
108868 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
108869 #line 3283 "parse.c"
108870 break;
108871 case 257: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
108872 #line 1153 "parse.y"
108873 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
108874 #line 3288 "parse.c"
108875 break;
108876 case 258: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
108877 #line 1155 "parse.y"
108878 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
108879 #line 3293 "parse.c"
108880 break;
108881 case 259: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
108882 #line 1157 "parse.y"
108883 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
108884 #line 3298 "parse.c"
108885 break;
108886 case 270: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
108887 #line 1175 "parse.y"
108888 {
108889 Token all;
108890 all.z = yymsp[-3].minor.yy0.z;
108891 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
108892 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
108893 }
108894 #line 3308 "parse.c"
108895 break;
108896 case 271: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
108897 #line 1184 "parse.y"
108898 {
108899 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy4, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy259, yymsp[0].minor.yy314, yymsp[-10].minor.yy4, yymsp[-8].minor.yy4);
108900 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
108901 }
108902 #line 3316 "parse.c"
108903 break;
108904 case 272: /* trigger_time ::= BEFORE */
108905 case 275: /* trigger_time ::= */ yytestcase(yyruleno==275);
108906 #line 1190 "parse.y"
108907 { yygotominor.yy4 = TK_BEFORE; }
108908 #line 3322 "parse.c"
108909 break;
108910 case 273: /* trigger_time ::= AFTER */
108911 #line 1191 "parse.y"
108912 { yygotominor.yy4 = TK_AFTER; }
108913 #line 3327 "parse.c"
108914 break;
108915 case 274: /* trigger_time ::= INSTEAD OF */
108916 #line 1192 "parse.y"
108917 { yygotominor.yy4 = TK_INSTEAD;}
108918 #line 3332 "parse.c"
108919 break;
108920 case 276: /* trigger_event ::= DELETE|INSERT */
108921 case 277: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==277);
108922 #line 1197 "parse.y"
108923 {yygotominor.yy90.a = yymsp[0].major; yygotominor.yy90.b = 0;}
108924 #line 3338 "parse.c"
108925 break;
108926 case 278: /* trigger_event ::= UPDATE OF inscollist */
108927 #line 1199 "parse.y"
108928 {yygotominor.yy90.a = TK_UPDATE; yygotominor.yy90.b = yymsp[0].minor.yy384;}
108929 #line 3343 "parse.c"
108930 break;
108931 case 281: /* when_clause ::= */
108932 case 303: /* key_opt ::= */ yytestcase(yyruleno==303);
108933 #line 1206 "parse.y"
108934 { yygotominor.yy314 = 0; }
108935 #line 3349 "parse.c"
108936 break;
108937 case 282: /* when_clause ::= WHEN expr */
108938 case 304: /* key_opt ::= KEY expr */ yytestcase(yyruleno==304);
108939 #line 1207 "parse.y"
108940 { yygotominor.yy314 = yymsp[0].minor.yy118.pExpr; }
108941 #line 3355 "parse.c"
108942 break;
108943 case 283: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
108944 #line 1211 "parse.y"
108945 {
108946 assert( yymsp[-2].minor.yy203!=0 );
108947 yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
108948 yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
108949 yygotominor.yy203 = yymsp[-2].minor.yy203;
108950 }
108951 #line 3365 "parse.c"
108952 break;
108953 case 284: /* trigger_cmd_list ::= trigger_cmd SEMI */
108954 #line 1217 "parse.y"
108955 {
108956 assert( yymsp[-1].minor.yy203!=0 );
108957 yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
108958 yygotominor.yy203 = yymsp[-1].minor.yy203;
108959 }
108960 #line 3374 "parse.c"
108961 break;
108962 case 286: /* trnm ::= nm DOT nm */
108963 #line 1229 "parse.y"
108964 {
108965 yygotominor.yy0 = yymsp[0].minor.yy0;
108966 sqlite3ErrorMsg(pParse,
108967 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
108968 "statements within triggers");
108969 }
108970 #line 3384 "parse.c"
108971 break;
108972 case 288: /* tridxby ::= INDEXED BY nm */
108973 #line 1241 "parse.y"
108974 {
108975 sqlite3ErrorMsg(pParse,
108976 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
108977 "within triggers");
108978 }
108979 #line 3393 "parse.c"
108980 break;
108981 case 289: /* tridxby ::= NOT INDEXED */
108982 #line 1246 "parse.y"
108983 {
108984 sqlite3ErrorMsg(pParse,
108985 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
108986 "within triggers");
108987 }
108988 #line 3402 "parse.c"
108989 break;
108990 case 290: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
108991 #line 1259 "parse.y"
108992 { yygotominor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy314, yymsp[-5].minor.yy210); }
108993 #line 3407 "parse.c"
108994 break;
108995 case 291: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP */
108996 #line 1264 "parse.y"
108997 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy384, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy210);}
108998 #line 3412 "parse.c"
108999 break;
109000 case 292: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
109001 #line 1267 "parse.y"
109002 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy384, 0, yymsp[0].minor.yy387, yymsp[-4].minor.yy210);}
109003 #line 3417 "parse.c"
109004 break;
109005 case 293: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
109006 #line 1271 "parse.y"
109007 {yygotominor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy314);}
109008 #line 3422 "parse.c"
109009 break;
109010 case 294: /* trigger_cmd ::= select */
109011 #line 1274 "parse.y"
109012 {yygotominor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy387); }
109013 #line 3427 "parse.c"
109014 break;
109015 case 295: /* expr ::= RAISE LP IGNORE RP */
109016 #line 1277 "parse.y"
109017 {
109018 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
109019 if( yygotominor.yy118.pExpr ){
109020 yygotominor.yy118.pExpr->affinity = OE_Ignore;
109021 }
109022 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
109023 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
109024 }
109025 #line 3439 "parse.c"
109026 break;
109027 case 296: /* expr ::= RAISE LP raisetype COMMA nm RP */
109028 #line 1285 "parse.y"
109029 {
109030 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
109031 if( yygotominor.yy118.pExpr ) {
109032 yygotominor.yy118.pExpr->affinity = (char)yymsp[-3].minor.yy4;
109033 }
109034 yygotominor.yy118.zStart = yymsp[-5].minor.yy0.z;
109035 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
109036 }
109037 #line 3451 "parse.c"
109038 break;
109039 case 297: /* raisetype ::= ROLLBACK */
109040 #line 1296 "parse.y"
109041 {yygotominor.yy4 = OE_Rollback;}
109042 #line 3456 "parse.c"
109043 break;
109044 case 299: /* raisetype ::= FAIL */
109045 #line 1298 "parse.y"
109046 {yygotominor.yy4 = OE_Fail;}
109047 #line 3461 "parse.c"
109048 break;
109049 case 300: /* cmd ::= DROP TRIGGER ifexists fullname */
109050 #line 1303 "parse.y"
109051 {
109052 sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
109053 }
109054 #line 3468 "parse.c"
109055 break;
109056 case 301: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
109057 #line 1310 "parse.y"
109058 {
109059 sqlite3Attach(pParse, yymsp[-3].minor.yy118.pExpr, yymsp[-1].minor.yy118.pExpr, yymsp[0].minor.yy314);
109060 }
109061 #line 3475 "parse.c"
109062 break;
109063 case 302: /* cmd ::= DETACH database_kw_opt expr */
109064 #line 1313 "parse.y"
109065 {
109066 sqlite3Detach(pParse, yymsp[0].minor.yy118.pExpr);
109067 }
109068 #line 3482 "parse.c"
109069 break;
109070 case 307: /* cmd ::= REINDEX */
109071 #line 1328 "parse.y"
109072 {sqlite3Reindex(pParse, 0, 0);}
109073 #line 3487 "parse.c"
109074 break;
109075 case 308: /* cmd ::= REINDEX nm dbnm */
109076 #line 1329 "parse.y"
109077 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
109078 #line 3492 "parse.c"
109079 break;
109080 case 309: /* cmd ::= ANALYZE */
109081 #line 1334 "parse.y"
109082 {sqlite3Analyze(pParse, 0, 0);}
109083 #line 3497 "parse.c"
109084 break;
109085 case 310: /* cmd ::= ANALYZE nm dbnm */
109086 #line 1335 "parse.y"
109087 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
109088 #line 3502 "parse.c"
109089 break;
109090 case 311: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
109091 #line 1340 "parse.y"
109092 {
109093 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
109094 }
109095 #line 3509 "parse.c"
109096 break;
109097 case 312: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
109098 #line 1343 "parse.y"
109099 {
109100 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
109101 }
109102 #line 3516 "parse.c"
109103 break;
109104 case 313: /* add_column_fullname ::= fullname */
109105 #line 1346 "parse.y"
109106 {
109107 pParse->db->lookaside.bEnabled = 0;
109108 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
109109 }
109110 #line 3524 "parse.c"
109111 break;
109112 case 316: /* cmd ::= create_vtab */
109113 #line 1356 "parse.y"
109114 {sqlite3VtabFinishParse(pParse,0);}
109115 #line 3529 "parse.c"
109116 break;
109117 case 317: /* cmd ::= create_vtab LP vtabarglist RP */
109118 #line 1357 "parse.y"
109119 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
109120 #line 3534 "parse.c"
109121 break;
109122 case 318: /* create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm */
109123 #line 1358 "parse.y"
109124 {
109125 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
109126 }
109127 #line 3541 "parse.c"
109128 break;
109129 case 321: /* vtabarg ::= */
109130 #line 1363 "parse.y"
109131 {sqlite3VtabArgInit(pParse);}
109132 #line 3546 "parse.c"
109133 break;
109134 case 323: /* vtabargtoken ::= ANY */
109135 case 324: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==324);
109136 case 325: /* lp ::= LP */ yytestcase(yyruleno==325);
109137 #line 1365 "parse.y"
109138 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
109139 #line 3553 "parse.c"
109140 break;
109141 default:
109142 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
109143 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
109144 /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2);
@@ -108751,15 +109236,17 @@
109236 int yymajor, /* The major type of the error token */
109237 YYMINORTYPE yyminor /* The minor type of the error token */
109238 ){
109239 sqlite3ParserARG_FETCH;
109240 #define TOKEN (yyminor.yy0)
109241 #line 32 "parse.y"
109242
109243 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
109244 assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
109245 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
109246 pParse->parseError = 1;
109247 #line 3661 "parse.c"
109248 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
109249 }
109250
109251 /*
109252 ** The following is executed when the parser accepts
@@ -108949,10 +109436,11 @@
109436 return;
109437 }
109438
109439 /************** End of parse.c ***********************************************/
109440 /************** Begin file tokenize.c ****************************************/
109441 #line 1 "tsrc/tokenize.c"
109442 /*
109443 ** 2001 September 15
109444 **
109445 ** The author disclaims copyright to this source code. In place of
109446 ** a legal notice, here is a blessing:
@@ -109014,10 +109502,11 @@
109502 ** named keywordhash.h and then included into this source file by
109503 ** the #include below.
109504 */
109505 /************** Include keywordhash.h in the middle of tokenize.c ************/
109506 /************** Begin file keywordhash.h *************************************/
109507 #line 1 "tsrc/keywordhash.h"
109508 /***** This file contains automatically generated code ******
109509 **
109510 ** The code in this file has been automatically generated by
109511 **
109512 ** sqlite/tool/mkkeywordhash.c
@@ -109287,10 +109776,11 @@
109776 }
109777 #define SQLITE_N_KEYWORD 121
109778
109779 /************** End of keywordhash.h *****************************************/
109780 /************** Continuing where we left off in tokenize.c *******************/
109781 #line 66 "tsrc/tokenize.c"
109782
109783
109784 /*
109785 ** If X is a character that can be used in an identifier then
109786 ** IdChar(X) will be true. Otherwise it is false.
@@ -109751,10 +110241,11 @@
110241 return nErr;
110242 }
110243
110244 /************** End of tokenize.c ********************************************/
110245 /************** Begin file complete.c ****************************************/
110246 #line 1 "tsrc/complete.c"
110247 /*
110248 ** 2001 September 15
110249 **
110250 ** The author disclaims copyright to this source code. In place of
110251 ** a legal notice, here is a blessing:
@@ -110036,10 +110527,11 @@
110527 #endif /* SQLITE_OMIT_UTF16 */
110528 #endif /* SQLITE_OMIT_COMPLETE */
110529
110530 /************** End of complete.c ********************************************/
110531 /************** Begin file main.c ********************************************/
110532 #line 1 "tsrc/main.c"
110533 /*
110534 ** 2001 September 15
110535 **
110536 ** The author disclaims copyright to this source code. In place of
110537 ** a legal notice, here is a blessing:
@@ -110056,10 +110548,11 @@
110548 */
110549
110550 #ifdef SQLITE_ENABLE_FTS3
110551 /************** Include fts3.h in the middle of main.c ***********************/
110552 /************** Begin file fts3.h ********************************************/
110553 #line 1 "tsrc/fts3.h"
110554 /*
110555 ** 2006 Oct 10
110556 **
110557 ** The author disclaims copyright to this source code. In place of
110558 ** a legal notice, here is a blessing:
@@ -110084,14 +110577,16 @@
110577 } /* extern "C" */
110578 #endif /* __cplusplus */
110579
110580 /************** End of fts3.h ************************************************/
110581 /************** Continuing where we left off in main.c ***********************/
110582 #line 21 "tsrc/main.c"
110583 #endif
110584 #ifdef SQLITE_ENABLE_RTREE
110585 /************** Include rtree.h in the middle of main.c **********************/
110586 /************** Begin file rtree.h *******************************************/
110587 #line 1 "tsrc/rtree.h"
110588 /*
110589 ** 2008 May 26
110590 **
110591 ** The author disclaims copyright to this source code. In place of
110592 ** a legal notice, here is a blessing:
@@ -110116,14 +110611,16 @@
110611 } /* extern "C" */
110612 #endif /* __cplusplus */
110613
110614 /************** End of rtree.h ***********************************************/
110615 /************** Continuing where we left off in main.c ***********************/
110616 #line 24 "tsrc/main.c"
110617 #endif
110618 #ifdef SQLITE_ENABLE_ICU
110619 /************** Include sqliteicu.h in the middle of main.c ******************/
110620 /************** Begin file sqliteicu.h ***************************************/
110621 #line 1 "tsrc/sqliteicu.h"
110622 /*
110623 ** 2008 May 26
110624 **
110625 ** The author disclaims copyright to this source code. In place of
110626 ** a legal notice, here is a blessing:
@@ -110149,10 +110646,11 @@
110646 #endif /* __cplusplus */
110647
110648
110649 /************** End of sqliteicu.h *******************************************/
110650 /************** Continuing where we left off in main.c ***********************/
110651 #line 27 "tsrc/main.c"
110652 #endif
110653
110654 #ifndef SQLITE_AMALGAMATION
110655 /* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
110656 ** contains the text of SQLITE_VERSION macro.
@@ -113079,10 +113577,11 @@
113577 return 0;
113578 }
113579
113580 /************** End of main.c ************************************************/
113581 /************** Begin file notify.c ******************************************/
113582 #line 1 "tsrc/notify.c"
113583 /*
113584 ** 2009 March 3
113585 **
113586 ** The author disclaims copyright to this source code. In place of
113587 ** a legal notice, here is a blessing:
@@ -113412,10 +113911,11 @@
113911 }
113912 #endif
113913
113914 /************** End of notify.c **********************************************/
113915 /************** Begin file fts3.c ********************************************/
113916 #line 1 "tsrc/fts3.c"
113917 /*
113918 ** 2006 Oct 10
113919 **
113920 ** The author disclaims copyright to this source code. In place of
113921 ** a legal notice, here is a blessing:
@@ -113708,10 +114208,11 @@
114208 ** into a single segment.
114209 */
114210
114211 /************** Include fts3Int.h in the middle of fts3.c ********************/
114212 /************** Begin file fts3Int.h *****************************************/
114213 #line 1 "tsrc/fts3Int.h"
114214 /*
114215 ** 2009 Nov 12
114216 **
114217 ** The author disclaims copyright to this source code. In place of
114218 ** a legal notice, here is a blessing:
@@ -113746,10 +114247,11 @@
114247 SQLITE_API extern const sqlite3_api_routines *sqlite3_api;
114248 #endif
114249
114250 /************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
114251 /************** Begin file fts3_tokenizer.h **********************************/
114252 #line 1 "tsrc/fts3_tokenizer.h"
114253 /*
114254 ** 2006 July 10
114255 **
114256 ** The author disclaims copyright to this source code.
114257 **
@@ -113900,12 +114402,14 @@
114402
114403 #endif /* _FTS3_TOKENIZER_H_ */
114404
114405 /************** End of fts3_tokenizer.h **************************************/
114406 /************** Continuing where we left off in fts3Int.h ********************/
114407 #line 40 "tsrc/fts3Int.h"
114408 /************** Include fts3_hash.h in the middle of fts3Int.h ***************/
114409 /************** Begin file fts3_hash.h ***************************************/
114410 #line 1 "tsrc/fts3_hash.h"
114411 /*
114412 ** 2001 September 22
114413 **
114414 ** The author disclaims copyright to this source code. In place of
114415 ** a legal notice, here is a blessing:
@@ -114017,10 +114521,11 @@
114521
114522 #endif /* _FTS3_HASH_H_ */
114523
114524 /************** End of fts3_hash.h *******************************************/
114525 /************** Continuing where we left off in fts3Int.h ********************/
114526 #line 41 "tsrc/fts3Int.h"
114527
114528 /*
114529 ** This constant controls how often segments are merged. Once there are
114530 ** FTS3_MERGE_COUNT segments of level N, they are merged into a single
114531 ** segment of level N+1.
@@ -114493,10 +114998,11 @@
114998 #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
114999 #endif /* _FTSINT_H */
115000
115001 /************** End of fts3Int.h *********************************************/
115002 /************** Continuing where we left off in fts3.c ***********************/
115003 #line 296 "tsrc/fts3.c"
115004 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
115005
115006 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
115007 # define SQLITE_CORE 1
115008 #endif
@@ -116264,11 +116770,41 @@
116770 char *aOut;
116771 int bFirstOut = 0;
116772
116773 *paOut = 0;
116774 *pnOut = 0;
116775
116776 /* Allocate space for the output. Both the input and output doclists
116777 ** are delta encoded. If they are in ascending order (bDescDoclist==0),
116778 ** then the first docid in each list is simply encoded as a varint. For
116779 ** each subsequent docid, the varint stored is the difference between the
116780 ** current and previous docid (a positive number - since the list is in
116781 ** ascending order).
116782 **
116783 ** The first docid written to the output is therefore encoded using the
116784 ** same number of bytes as it is in whichever of the input lists it is
116785 ** read from. And each subsequent docid read from the same input list
116786 ** consumes either the same or less bytes as it did in the input (since
116787 ** the difference between it and the previous value in the output must
116788 ** be a positive value less than or equal to the delta value read from
116789 ** the input list). The same argument applies to all but the first docid
116790 ** read from the 'other' list. And to the contents of all position lists
116791 ** that will be copied and merged from the input to the output.
116792 **
116793 ** However, if the first docid copied to the output is a negative number,
116794 ** then the encoding of the first docid from the 'other' input list may
116795 ** be larger in the output than it was in the input (since the delta value
116796 ** may be a larger positive integer than the actual docid).
116797 **
116798 ** The space required to store the output is therefore the sum of the
116799 ** sizes of the two inputs, plus enough space for exactly one of the input
116800 ** docids to grow.
116801 **
116802 ** A symetric argument may be made if the doclists are in descending
116803 ** order.
116804 */
116805 aOut = sqlite3_malloc(n1+n2+FTS3_VARINT_MAX-1);
116806 if( !aOut ) return SQLITE_NOMEM;
116807
116808 p = aOut;
116809 fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);
116810 fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);
@@ -116291,10 +116827,11 @@
116827 }
116828 }
116829
116830 *paOut = aOut;
116831 *pnOut = (p-aOut);
116832 assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 );
116833 return SQLITE_OK;
116834 }
116835
116836 /*
116837 ** This function does a "phrase" merge of two doclists. In a phrase merge,
@@ -119011,10 +119548,11 @@
119548
119549 #endif
119550
119551 /************** End of fts3.c ************************************************/
119552 /************** Begin file fts3_aux.c ****************************************/
119553 #line 1 "tsrc/fts3_aux.c"
119554 /*
119555 ** 2011 Jan 27
119556 **
119557 ** The author disclaims copyright to this source code. In place of
119558 ** a legal notice, here is a blessing:
@@ -119487,10 +120025,11 @@
120025
120026 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120027
120028 /************** End of fts3_aux.c ********************************************/
120029 /************** Begin file fts3_expr.c ***************************************/
120030 #line 1 "tsrc/fts3_expr.c"
120031 /*
120032 ** 2008 Nov 28
120033 **
120034 ** The author disclaims copyright to this source code. In place of
120035 ** a legal notice, here is a blessing:
@@ -120453,10 +120992,11 @@
120992 #endif
120993 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
120994
120995 /************** End of fts3_expr.c *******************************************/
120996 /************** Begin file fts3_hash.c ***************************************/
120997 #line 1 "tsrc/fts3_hash.c"
120998 /*
120999 ** 2001 September 22
121000 **
121001 ** The author disclaims copyright to this source code. In place of
121002 ** a legal notice, here is a blessing:
@@ -120837,10 +121377,11 @@
121377
121378 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
121379
121380 /************** End of fts3_hash.c *******************************************/
121381 /************** Begin file fts3_porter.c *************************************/
121382 #line 1 "tsrc/fts3_porter.c"
121383 /*
121384 ** 2006 September 30
121385 **
121386 ** The author disclaims copyright to this source code. In place of
121387 ** a legal notice, here is a blessing:
@@ -121483,10 +122024,11 @@
122024
122025 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
122026
122027 /************** End of fts3_porter.c *****************************************/
122028 /************** Begin file fts3_tokenizer.c **********************************/
122029 #line 1 "tsrc/fts3_tokenizer.c"
122030 /*
122031 ** 2007 June 22
122032 **
122033 ** The author disclaims copyright to this source code. In place of
122034 ** a legal notice, here is a blessing:
@@ -121974,10 +122516,11 @@
122516
122517 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
122518
122519 /************** End of fts3_tokenizer.c **************************************/
122520 /************** Begin file fts3_tokenizer1.c *********************************/
122521 #line 1 "tsrc/fts3_tokenizer1.c"
122522 /*
122523 ** 2006 Oct 10
122524 **
122525 ** The author disclaims copyright to this source code. In place of
122526 ** a legal notice, here is a blessing:
@@ -122208,10 +122751,11 @@
122751
122752 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
122753
122754 /************** End of fts3_tokenizer1.c *************************************/
122755 /************** Begin file fts3_write.c **************************************/
122756 #line 1 "tsrc/fts3_write.c"
122757 /*
122758 ** 2009 Oct 23
122759 **
122760 ** The author disclaims copyright to this source code. In place of
122761 ** a legal notice, here is a blessing:
@@ -125478,10 +126022,11 @@
126022
126023 #endif
126024
126025 /************** End of fts3_write.c ******************************************/
126026 /************** Begin file fts3_snippet.c ************************************/
126027 #line 1 "tsrc/fts3_snippet.c"
126028 /*
126029 ** 2009 Oct 23
126030 **
126031 ** The author disclaims copyright to this source code. In place of
126032 ** a legal notice, here is a blessing:
@@ -126979,10 +127524,11 @@
127524
127525 #endif
127526
127527 /************** End of fts3_snippet.c ****************************************/
127528 /************** Begin file rtree.c *******************************************/
127529 #line 1 "tsrc/rtree.c"
127530 /*
127531 ** 2001 September 15
127532 **
127533 ** The author disclaims copyright to this source code. In place of
127534 ** a legal notice, here is a blessing:
@@ -130260,10 +130806,11 @@
130806
130807 #endif
130808
130809 /************** End of rtree.c ***********************************************/
130810 /************** Begin file icu.c *********************************************/
130811 #line 1 "tsrc/icu.c"
130812 /*
130813 ** 2007 May 6
130814 **
130815 ** The author disclaims copyright to this source code. In place of
130816 ** a legal notice, here is a blessing:
@@ -130762,10 +131309,11 @@
131309
131310 #endif
131311
131312 /************** End of icu.c *************************************************/
131313 /************** Begin file fts3_icu.c ****************************************/
131314 #line 1 "tsrc/fts3_icu.c"
131315 /*
131316 ** 2007 June 22
131317 **
131318 ** The author disclaims copyright to this source code. In place of
131319 ** a legal notice, here is a blessing:
131320
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.8"
111111
#define SQLITE_VERSION_NUMBER 3007008
112
-#define SQLITE_SOURCE_ID "2011-09-04 01:27:00 6b657ae75035eb10b0ad640998d3c9eadfdffa6e"
112
+#define SQLITE_SOURCE_ID "2011-09-14 13:41:40 a1f3aeeb0988c848d40ce8f6da6e902935a997e2"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.8"
111 #define SQLITE_VERSION_NUMBER 3007008
112 #define SQLITE_SOURCE_ID "2011-09-04 01:27:00 6b657ae75035eb10b0ad640998d3c9eadfdffa6e"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.8"
111 #define SQLITE_VERSION_NUMBER 3007008
112 #define SQLITE_SOURCE_ID "2011-09-14 13:41:40 a1f3aeeb0988c848d40ce8f6da6e902935a997e2"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
+1 -1
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
3434
const char *zDb;
3535
int brief;
3636
char zBuf[100];
3737
3838
login_check_credentials();
39
- if( !g.okRead ){ login_needed(); return; }
39
+ if( !g.perm.Read ){ login_needed(); return; }
4040
brief = P("brief")!=0;
4141
style_header("Repository Statistics");
4242
@ <table class="label-value">
4343
@ <tr><th>Repository&nbsp;Size:</th><td>
4444
fsize = file_size(g.zRepositoryName);
4545
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
34 const char *zDb;
35 int brief;
36 char zBuf[100];
37
38 login_check_credentials();
39 if( !g.okRead ){ login_needed(); return; }
40 brief = P("brief")!=0;
41 style_header("Repository Statistics");
42 @ <table class="label-value">
43 @ <tr><th>Repository&nbsp;Size:</th><td>
44 fsize = file_size(g.zRepositoryName);
45
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
34 const char *zDb;
35 int brief;
36 char zBuf[100];
37
38 login_check_credentials();
39 if( !g.perm.Read ){ login_needed(); return; }
40 brief = P("brief")!=0;
41 style_header("Repository Statistics");
42 @ <table class="label-value">
43 @ <tr><th>Repository&nbsp;Size:</th><td>
44 fsize = file_size(g.zRepositoryName);
45
+1 -1
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820820
@ g.userUid = %d(g.userUid)<br />
821821
@ g.zLogin = %h(g.zLogin)<br />
822822
@ capabilities = %s(zCap)<br />
823823
@ <hr>
824824
cgi_print_all();
825
- if( g.okSetup ){
825
+ if( g.perm.Setup ){
826826
const char *zRedir = P("redirect");
827827
if( zRedir ) cgi_redirect(zRedir);
828828
}
829829
style_footer();
830830
}
831831
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820 @ g.userUid = %d(g.userUid)<br />
821 @ g.zLogin = %h(g.zLogin)<br />
822 @ capabilities = %s(zCap)<br />
823 @ <hr>
824 cgi_print_all();
825 if( g.okSetup ){
826 const char *zRedir = P("redirect");
827 if( zRedir ) cgi_redirect(zRedir);
828 }
829 style_footer();
830 }
831
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820 @ g.userUid = %d(g.userUid)<br />
821 @ g.zLogin = %h(g.zLogin)<br />
822 @ capabilities = %s(zCap)<br />
823 @ <hr>
824 cgi_print_all();
825 if( g.perm.Setup ){
826 const char *zRedir = P("redirect");
827 if( zRedir ) cgi_redirect(zRedir);
828 }
829 style_footer();
830 }
831
+3 -3
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529529
*/
530530
void taglist_page(void){
531531
Stmt q;
532532
533533
login_check_credentials();
534
- if( !g.okRead ){
534
+ if( !g.perm.Read ){
535535
login_needed();
536536
}
537537
login_anonymous_available();
538538
style_header("Tags");
539539
style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548548
" ORDER BY tagname"
549549
);
550550
@ <ul>
551551
while( db_step(&q)==SQLITE_ROW ){
552552
const char *zName = db_column_text(&q, 0);
553
- if( g.okHistory ){
553
+ if( g.perm.History ){
554554
@ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555555
@ %h(zName)</a></li>
556556
}else{
557557
@ <li><span class="tagDsp">%h(zName)</span></li>
558558
}
@@ -567,11 +567,11 @@
567567
*/
568568
void tagtimeline_page(void){
569569
Stmt q;
570570
571571
login_check_credentials();
572
- if( !g.okRead ){ login_needed(); return; }
572
+ if( !g.perm.Read ){ login_needed(); return; }
573573
574574
style_header("Tagged Check-ins");
575575
style_submenu_element("List", "List", "taglist");
576576
login_anonymous_available();
577577
@ <h2>Check-ins with non-propagating tags:</h2>
578578
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529 */
530 void taglist_page(void){
531 Stmt q;
532
533 login_check_credentials();
534 if( !g.okRead ){
535 login_needed();
536 }
537 login_anonymous_available();
538 style_header("Tags");
539 style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548 " ORDER BY tagname"
549 );
550 @ <ul>
551 while( db_step(&q)==SQLITE_ROW ){
552 const char *zName = db_column_text(&q, 0);
553 if( g.okHistory ){
554 @ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555 @ %h(zName)</a></li>
556 }else{
557 @ <li><span class="tagDsp">%h(zName)</span></li>
558 }
@@ -567,11 +567,11 @@
567 */
568 void tagtimeline_page(void){
569 Stmt q;
570
571 login_check_credentials();
572 if( !g.okRead ){ login_needed(); return; }
573
574 style_header("Tagged Check-ins");
575 style_submenu_element("List", "List", "taglist");
576 login_anonymous_available();
577 @ <h2>Check-ins with non-propagating tags:</h2>
578
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529 */
530 void taglist_page(void){
531 Stmt q;
532
533 login_check_credentials();
534 if( !g.perm.Read ){
535 login_needed();
536 }
537 login_anonymous_available();
538 style_header("Tags");
539 style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548 " ORDER BY tagname"
549 );
550 @ <ul>
551 while( db_step(&q)==SQLITE_ROW ){
552 const char *zName = db_column_text(&q, 0);
553 if( g.perm.History ){
554 @ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555 @ %h(zName)</a></li>
556 }else{
557 @ <li><span class="tagDsp">%h(zName)</span></li>
558 }
@@ -567,11 +567,11 @@
567 */
568 void tagtimeline_page(void){
569 Stmt q;
570
571 login_check_credentials();
572 if( !g.perm.Read ){ login_needed(); return; }
573
574 style_header("Tagged Check-ins");
575 style_submenu_element("List", "List", "taglist");
576 login_anonymous_available();
577 @ <h2>Check-ins with non-propagating tags:</h2>
578
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572572
char *zName, *zRid;
573573
int nName, nRid;
574574
Blob tarball;
575575
576576
login_check_credentials();
577
- if( !g.okZip ){ login_needed(); return; }
577
+ if( !g.perm.Zip ){ login_needed(); return; }
578578
zName = mprintf("%s", PD("name",""));
579579
nName = strlen(zName);
580580
zRid = mprintf("%s", PD("uuid",""));
581581
nRid = strlen(zRid);
582582
if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583583
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572 char *zName, *zRid;
573 int nName, nRid;
574 Blob tarball;
575
576 login_check_credentials();
577 if( !g.okZip ){ login_needed(); return; }
578 zName = mprintf("%s", PD("name",""));
579 nName = strlen(zName);
580 zRid = mprintf("%s", PD("uuid",""));
581 nRid = strlen(zRid);
582 if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572 char *zName, *zRid;
573 int nName, nRid;
574 Blob tarball;
575
576 login_check_credentials();
577 if( !g.perm.Zip ){ login_needed(); return; }
578 zName = mprintf("%s", PD("name",""));
579 nName = strlen(zName);
580 zRid = mprintf("%s", PD("uuid",""));
581 nRid = strlen(zRid);
582 if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583
+31 -31
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
4747
** Generate a hyperlink to a version.
4848
*/
4949
void hyperlink_to_uuid(const char *zUuid){
5050
char z[UUID_SIZE+1];
5151
shorten_uuid(z, zUuid);
52
- if( g.okHistory ){
52
+ if( g.perm.History ){
5353
@ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
5454
}else{
5555
@ <span class="timelineHistDsp">[%s(z)]</span>
5656
}
5757
}
@@ -58,11 +58,11 @@
5858
5959
/*
6060
** Generate a hyperlink to a diff between two versions.
6161
*/
6262
void hyperlink_to_diff(const char *zV1, const char *zV2){
63
- if( g.okHistory ){
63
+ if( g.perm.History ){
6464
if( zV2==0 ){
6565
@ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
6666
}else{
6767
@ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
6868
}
@@ -72,11 +72,11 @@
7272
/*
7373
** Generate a hyperlink to a date & time.
7474
*/
7575
void hyperlink_to_date(const char *zDate, const char *zSuffix){
7676
if( zSuffix==0 ) zSuffix = "";
77
- if( g.okHistory ){
77
+ if( g.perm.History ){
7878
@ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
7979
}else{
8080
@ %s(zDate)%s(zSuffix)
8181
}
8282
}
@@ -86,11 +86,11 @@
8686
** events by that user. If the date+time is specified, then the timeline
8787
** is centered on that date+time.
8888
*/
8989
void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
9090
if( zSuf==0 ) zSuf = "";
91
- if( g.okHistory ){
91
+ if( g.perm.History ){
9292
if( zD && zD[0] ){
9393
@ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
9494
}else{
9595
@ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
9696
}
@@ -350,11 +350,11 @@
350350
351351
/* Generate the "user: USERNAME" at the end of the comment, together
352352
** with a hyperlink to another timeline for that user.
353353
*/
354354
if( zTagList && zTagList[0]==0 ) zTagList = 0;
355
- if( g.okHistory && fossil_strcmp(zUser, zThisUser)!=0 ){
355
+ if( g.perm.History && fossil_strcmp(zUser, zThisUser)!=0 ){
356356
char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357357
g.zTop, zUser, zDate);
358358
@ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359359
fossil_free(zLink);
360360
}else{
@@ -363,11 +363,11 @@
363363
364364
/* Generate the "tags: TAGLIST" at the end of the comment, together
365365
** with hyperlinks to the tag list.
366366
*/
367367
if( zTagList ){
368
- if( g.okHistory ){
368
+ if( g.perm.History ){
369369
int i;
370370
const char *z = zTagList;
371371
Blob links;
372372
blob_zero(&links);
373373
while( z && z[0] ){
@@ -394,11 +394,11 @@
394394
if( xExtra ){
395395
xExtra(rid);
396396
}
397397
398398
/* Generate the file-change list if requested */
399
- if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.okHistory ){
399
+ if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.History ){
400400
int inUl = 0;
401401
if( !fchngQueryInit ){
402402
db_prepare(&fchngQuery,
403403
"SELECT (pid==0) AS isnew,"
404404
" (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896896
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897897
898898
/* To view the timeline, must have permission to read project data.
899899
*/
900900
login_check_credentials();
901
- if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
902
- if( zTagName && g.okRead ){
901
+ if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; }
902
+ if( zTagName && g.perm.Read ){
903903
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904904
zThisTag = zTagName;
905
- }else if( zBrName && g.okRead ){
905
+ }else if( zBrName && g.perm.Read ){
906906
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907907
zThisTag = zBrName;
908908
}else{
909909
tagid = 0;
910910
}
@@ -930,11 +930,11 @@
930930
if( P("fc")!=0 || P("detail")!=0 ){
931931
tmFlags |= TIMELINE_FCHANGES;
932932
url_add_parameter(&url, "fc", 0);
933933
}
934934
if( !useDividers ) url_add_parameter(&url, "nd", 0);
935
- if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.okRead ){
935
+ if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
936936
/* If from= and to= are present, display all nodes on a path connecting
937937
** the two */
938938
PathNode *p = 0;
939939
const char *zFrom = 0;
940940
const char *zTo = 0;
@@ -956,24 +956,24 @@
956956
p = p->u.pTo;
957957
}
958958
blob_append(&sql, ")", -1);
959959
path_reset();
960960
blob_append(&desc, "All nodes on the path from ", -1);
961
- if( g.okHistory ){
961
+ if( g.perm.History ){
962962
blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963963
}else{
964964
blob_appendf(&desc, "[%h]", zFrom);
965965
}
966966
blob_append(&desc, " and ", -1);
967
- if( g.okHistory ){
967
+ if( g.perm.History ){
968968
blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969969
}else{
970970
blob_appendf(&desc, "[%h].", zTo);
971971
}
972972
tmFlags |= TIMELINE_DISJOINT;
973973
db_multi_exec("%s", blob_str(&sql));
974
- }else if( (p_rid || d_rid) && g.okRead ){
974
+ }else if( (p_rid || d_rid) && g.perm.Read ){
975975
/* If p= or d= is present, ignore all other parameters other than n= */
976976
char *zUuid;
977977
int np, nd;
978978
979979
if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
10051005
blob_appendf(&desc, "%d ancestors", np);
10061006
db_multi_exec("%s", blob_str(&sql));
10071007
}
10081008
if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
10091009
}
1010
- if( g.okHistory ){
1010
+ if( g.perm.History ){
10111011
blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
10121012
g.zTop, zUuid, zUuid);
10131013
}else{
10141014
blob_appendf(&desc, " of check-in [%.10s]", zUuid);
10151015
}
1016
- }else if( f_rid && g.okRead ){
1016
+ }else if( f_rid && g.perm.Read ){
10171017
/* If f= is present, ignore all other parameters other than n= */
10181018
char *zUuid;
10191019
db_multi_exec(
10201020
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
10211021
"INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
10261026
blob_appendf(&sql, " AND event.objid IN ok");
10271027
db_multi_exec("%s", blob_str(&sql));
10281028
if( useDividers ) timeline_add_dividers(0, f_rid);
10291029
blob_appendf(&desc, "Parents and children of check-in ");
10301030
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031
- if( g.okHistory ){
1031
+ if( g.perm.History ){
10321032
blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
10331033
g.zTop, zUuid, zUuid);
10341034
}else{
10351035
blob_appendf(&desc, "[%.10s]", zUuid);
10361036
}
@@ -1071,30 +1071,30 @@
10711071
}else{
10721072
url_add_parameter(&url, "t", zTagName);
10731073
}
10741074
blob_appendf(&sql, ")");
10751075
}
1076
- if( (zType[0]=='w' && !g.okRdWiki)
1077
- || (zType[0]=='t' && !g.okRdTkt)
1078
- || (zType[0]=='e' && !g.okRdWiki)
1079
- || (zType[0]=='c' && !g.okRead)
1076
+ if( (zType[0]=='w' && !g.perm.RdWiki)
1077
+ || (zType[0]=='t' && !g.perm.RdTkt)
1078
+ || (zType[0]=='e' && !g.perm.RdWiki)
1079
+ || (zType[0]=='c' && !g.perm.Read)
10801080
){
10811081
zType = "all";
10821082
}
10831083
if( zType[0]=='a' ){
1084
- if( !g.okRead || !g.okRdWiki || !g.okRdTkt ){
1084
+ if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){
10851085
char cSep = '(';
10861086
blob_appendf(&sql, " AND event.type IN ");
1087
- if( g.okRead ){
1087
+ if( g.perm.Read ){
10881088
blob_appendf(&sql, "%c'ci'", cSep);
10891089
cSep = ',';
10901090
}
1091
- if( g.okRdWiki ){
1091
+ if( g.perm.RdWiki ){
10921092
blob_appendf(&sql, "%c'w','e'", cSep);
10931093
cSep = ',';
10941094
}
1095
- if( g.okRdTkt ){
1095
+ if( g.perm.RdTkt ){
10961096
blob_appendf(&sql, "%c't'", cSep);
10971097
cSep = ',';
10981098
}
10991099
blob_appendf(&sql, ")");
11001100
}
@@ -1200,11 +1200,11 @@
12001200
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
12011201
}
12021202
if( zSearch ){
12031203
blob_appendf(&desc, " matching \"%h\"", zSearch);
12041204
}
1205
- if( g.okHistory ){
1205
+ if( g.perm.History ){
12061206
if( zAfter || n==nEntry ){
12071207
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
12081208
timeline_submenu(&url, "Older", "b", zDate, "a");
12091209
free(zDate);
12101210
}
@@ -1214,20 +1214,20 @@
12141214
free(zDate);
12151215
}else if( tagid==0 ){
12161216
if( zType[0]!='a' ){
12171217
timeline_submenu(&url, "All Types", "y", "all", 0);
12181218
}
1219
- if( zType[0]!='w' && g.okRdWiki ){
1219
+ if( zType[0]!='w' && g.perm.RdWiki ){
12201220
timeline_submenu(&url, "Wiki Only", "y", "w", 0);
12211221
}
1222
- if( zType[0]!='c' && g.okRead ){
1222
+ if( zType[0]!='c' && g.perm.Read ){
12231223
timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
12241224
}
1225
- if( zType[0]!='t' && g.okRdTkt ){
1225
+ if( zType[0]!='t' && g.perm.RdTkt ){
12261226
timeline_submenu(&url, "Tickets Only", "y", "t", 0);
12271227
}
1228
- if( zType[0]!='e' && g.okRdWiki ){
1228
+ if( zType[0]!='e' && g.perm.RdWiki ){
12291229
timeline_submenu(&url, "Events Only", "y", "e", 0);
12301230
}
12311231
}
12321232
if( nEntry>20 ){
12331233
timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
16021602
*/
16031603
void test_timewarp_page(void){
16041604
Stmt q;
16051605
16061606
login_check_credentials();
1607
- if( !g.okRead || !g.okHistory ){ login_needed(); return; }
1607
+ if( !g.perm.Read || !g.perm.History ){ login_needed(); return; }
16081608
style_header("Instances of timewarp");
16091609
@ <ul>
16101610
db_prepare(&q,
16111611
"SELECT blob.uuid "
16121612
" FROM plink p, plink c, blob"
16131613
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
47 ** Generate a hyperlink to a version.
48 */
49 void hyperlink_to_uuid(const char *zUuid){
50 char z[UUID_SIZE+1];
51 shorten_uuid(z, zUuid);
52 if( g.okHistory ){
53 @ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
@@ -58,11 +58,11 @@
58
59 /*
60 ** Generate a hyperlink to a diff between two versions.
61 */
62 void hyperlink_to_diff(const char *zV1, const char *zV2){
63 if( g.okHistory ){
64 if( zV2==0 ){
65 @ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
66 }else{
67 @ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
68 }
@@ -72,11 +72,11 @@
72 /*
73 ** Generate a hyperlink to a date & time.
74 */
75 void hyperlink_to_date(const char *zDate, const char *zSuffix){
76 if( zSuffix==0 ) zSuffix = "";
77 if( g.okHistory ){
78 @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
79 }else{
80 @ %s(zDate)%s(zSuffix)
81 }
82 }
@@ -86,11 +86,11 @@
86 ** events by that user. If the date+time is specified, then the timeline
87 ** is centered on that date+time.
88 */
89 void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
90 if( zSuf==0 ) zSuf = "";
91 if( g.okHistory ){
92 if( zD && zD[0] ){
93 @ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
94 }else{
95 @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
96 }
@@ -350,11 +350,11 @@
350
351 /* Generate the "user: USERNAME" at the end of the comment, together
352 ** with a hyperlink to another timeline for that user.
353 */
354 if( zTagList && zTagList[0]==0 ) zTagList = 0;
355 if( g.okHistory && fossil_strcmp(zUser, zThisUser)!=0 ){
356 char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357 g.zTop, zUser, zDate);
358 @ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359 fossil_free(zLink);
360 }else{
@@ -363,11 +363,11 @@
363
364 /* Generate the "tags: TAGLIST" at the end of the comment, together
365 ** with hyperlinks to the tag list.
366 */
367 if( zTagList ){
368 if( g.okHistory ){
369 int i;
370 const char *z = zTagList;
371 Blob links;
372 blob_zero(&links);
373 while( z && z[0] ){
@@ -394,11 +394,11 @@
394 if( xExtra ){
395 xExtra(rid);
396 }
397
398 /* Generate the file-change list if requested */
399 if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.okHistory ){
400 int inUl = 0;
401 if( !fchngQueryInit ){
402 db_prepare(&fchngQuery,
403 "SELECT (pid==0) AS isnew,"
404 " (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897
898 /* To view the timeline, must have permission to read project data.
899 */
900 login_check_credentials();
901 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
902 if( zTagName && g.okRead ){
903 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904 zThisTag = zTagName;
905 }else if( zBrName && g.okRead ){
906 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907 zThisTag = zBrName;
908 }else{
909 tagid = 0;
910 }
@@ -930,11 +930,11 @@
930 if( P("fc")!=0 || P("detail")!=0 ){
931 tmFlags |= TIMELINE_FCHANGES;
932 url_add_parameter(&url, "fc", 0);
933 }
934 if( !useDividers ) url_add_parameter(&url, "nd", 0);
935 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.okRead ){
936 /* If from= and to= are present, display all nodes on a path connecting
937 ** the two */
938 PathNode *p = 0;
939 const char *zFrom = 0;
940 const char *zTo = 0;
@@ -956,24 +956,24 @@
956 p = p->u.pTo;
957 }
958 blob_append(&sql, ")", -1);
959 path_reset();
960 blob_append(&desc, "All nodes on the path from ", -1);
961 if( g.okHistory ){
962 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963 }else{
964 blob_appendf(&desc, "[%h]", zFrom);
965 }
966 blob_append(&desc, " and ", -1);
967 if( g.okHistory ){
968 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969 }else{
970 blob_appendf(&desc, "[%h].", zTo);
971 }
972 tmFlags |= TIMELINE_DISJOINT;
973 db_multi_exec("%s", blob_str(&sql));
974 }else if( (p_rid || d_rid) && g.okRead ){
975 /* If p= or d= is present, ignore all other parameters other than n= */
976 char *zUuid;
977 int np, nd;
978
979 if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
1005 blob_appendf(&desc, "%d ancestors", np);
1006 db_multi_exec("%s", blob_str(&sql));
1007 }
1008 if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1009 }
1010 if( g.okHistory ){
1011 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
1012 g.zTop, zUuid, zUuid);
1013 }else{
1014 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
1015 }
1016 }else if( f_rid && g.okRead ){
1017 /* If f= is present, ignore all other parameters other than n= */
1018 char *zUuid;
1019 db_multi_exec(
1020 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
1021 "INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
1026 blob_appendf(&sql, " AND event.objid IN ok");
1027 db_multi_exec("%s", blob_str(&sql));
1028 if( useDividers ) timeline_add_dividers(0, f_rid);
1029 blob_appendf(&desc, "Parents and children of check-in ");
1030 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031 if( g.okHistory ){
1032 blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
1033 g.zTop, zUuid, zUuid);
1034 }else{
1035 blob_appendf(&desc, "[%.10s]", zUuid);
1036 }
@@ -1071,30 +1071,30 @@
1071 }else{
1072 url_add_parameter(&url, "t", zTagName);
1073 }
1074 blob_appendf(&sql, ")");
1075 }
1076 if( (zType[0]=='w' && !g.okRdWiki)
1077 || (zType[0]=='t' && !g.okRdTkt)
1078 || (zType[0]=='e' && !g.okRdWiki)
1079 || (zType[0]=='c' && !g.okRead)
1080 ){
1081 zType = "all";
1082 }
1083 if( zType[0]=='a' ){
1084 if( !g.okRead || !g.okRdWiki || !g.okRdTkt ){
1085 char cSep = '(';
1086 blob_appendf(&sql, " AND event.type IN ");
1087 if( g.okRead ){
1088 blob_appendf(&sql, "%c'ci'", cSep);
1089 cSep = ',';
1090 }
1091 if( g.okRdWiki ){
1092 blob_appendf(&sql, "%c'w','e'", cSep);
1093 cSep = ',';
1094 }
1095 if( g.okRdTkt ){
1096 blob_appendf(&sql, "%c't'", cSep);
1097 cSep = ',';
1098 }
1099 blob_appendf(&sql, ")");
1100 }
@@ -1200,11 +1200,11 @@
1200 blob_appendf(&desc, " occurring around %h.<br />", zCirca);
1201 }
1202 if( zSearch ){
1203 blob_appendf(&desc, " matching \"%h\"", zSearch);
1204 }
1205 if( g.okHistory ){
1206 if( zAfter || n==nEntry ){
1207 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1208 timeline_submenu(&url, "Older", "b", zDate, "a");
1209 free(zDate);
1210 }
@@ -1214,20 +1214,20 @@
1214 free(zDate);
1215 }else if( tagid==0 ){
1216 if( zType[0]!='a' ){
1217 timeline_submenu(&url, "All Types", "y", "all", 0);
1218 }
1219 if( zType[0]!='w' && g.okRdWiki ){
1220 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
1221 }
1222 if( zType[0]!='c' && g.okRead ){
1223 timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
1224 }
1225 if( zType[0]!='t' && g.okRdTkt ){
1226 timeline_submenu(&url, "Tickets Only", "y", "t", 0);
1227 }
1228 if( zType[0]!='e' && g.okRdWiki ){
1229 timeline_submenu(&url, "Events Only", "y", "e", 0);
1230 }
1231 }
1232 if( nEntry>20 ){
1233 timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
1602 */
1603 void test_timewarp_page(void){
1604 Stmt q;
1605
1606 login_check_credentials();
1607 if( !g.okRead || !g.okHistory ){ login_needed(); return; }
1608 style_header("Instances of timewarp");
1609 @ <ul>
1610 db_prepare(&q,
1611 "SELECT blob.uuid "
1612 " FROM plink p, plink c, blob"
1613
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
47 ** Generate a hyperlink to a version.
48 */
49 void hyperlink_to_uuid(const char *zUuid){
50 char z[UUID_SIZE+1];
51 shorten_uuid(z, zUuid);
52 if( g.perm.History ){
53 @ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
@@ -58,11 +58,11 @@
58
59 /*
60 ** Generate a hyperlink to a diff between two versions.
61 */
62 void hyperlink_to_diff(const char *zV1, const char *zV2){
63 if( g.perm.History ){
64 if( zV2==0 ){
65 @ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
66 }else{
67 @ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
68 }
@@ -72,11 +72,11 @@
72 /*
73 ** Generate a hyperlink to a date & time.
74 */
75 void hyperlink_to_date(const char *zDate, const char *zSuffix){
76 if( zSuffix==0 ) zSuffix = "";
77 if( g.perm.History ){
78 @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
79 }else{
80 @ %s(zDate)%s(zSuffix)
81 }
82 }
@@ -86,11 +86,11 @@
86 ** events by that user. If the date+time is specified, then the timeline
87 ** is centered on that date+time.
88 */
89 void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
90 if( zSuf==0 ) zSuf = "";
91 if( g.perm.History ){
92 if( zD && zD[0] ){
93 @ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
94 }else{
95 @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
96 }
@@ -350,11 +350,11 @@
350
351 /* Generate the "user: USERNAME" at the end of the comment, together
352 ** with a hyperlink to another timeline for that user.
353 */
354 if( zTagList && zTagList[0]==0 ) zTagList = 0;
355 if( g.perm.History && fossil_strcmp(zUser, zThisUser)!=0 ){
356 char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357 g.zTop, zUser, zDate);
358 @ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359 fossil_free(zLink);
360 }else{
@@ -363,11 +363,11 @@
363
364 /* Generate the "tags: TAGLIST" at the end of the comment, together
365 ** with hyperlinks to the tag list.
366 */
367 if( zTagList ){
368 if( g.perm.History ){
369 int i;
370 const char *z = zTagList;
371 Blob links;
372 blob_zero(&links);
373 while( z && z[0] ){
@@ -394,11 +394,11 @@
394 if( xExtra ){
395 xExtra(rid);
396 }
397
398 /* Generate the file-change list if requested */
399 if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.History ){
400 int inUl = 0;
401 if( !fchngQueryInit ){
402 db_prepare(&fchngQuery,
403 "SELECT (pid==0) AS isnew,"
404 " (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897
898 /* To view the timeline, must have permission to read project data.
899 */
900 login_check_credentials();
901 if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; }
902 if( zTagName && g.perm.Read ){
903 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904 zThisTag = zTagName;
905 }else if( zBrName && g.perm.Read ){
906 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907 zThisTag = zBrName;
908 }else{
909 tagid = 0;
910 }
@@ -930,11 +930,11 @@
930 if( P("fc")!=0 || P("detail")!=0 ){
931 tmFlags |= TIMELINE_FCHANGES;
932 url_add_parameter(&url, "fc", 0);
933 }
934 if( !useDividers ) url_add_parameter(&url, "nd", 0);
935 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
936 /* If from= and to= are present, display all nodes on a path connecting
937 ** the two */
938 PathNode *p = 0;
939 const char *zFrom = 0;
940 const char *zTo = 0;
@@ -956,24 +956,24 @@
956 p = p->u.pTo;
957 }
958 blob_append(&sql, ")", -1);
959 path_reset();
960 blob_append(&desc, "All nodes on the path from ", -1);
961 if( g.perm.History ){
962 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963 }else{
964 blob_appendf(&desc, "[%h]", zFrom);
965 }
966 blob_append(&desc, " and ", -1);
967 if( g.perm.History ){
968 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969 }else{
970 blob_appendf(&desc, "[%h].", zTo);
971 }
972 tmFlags |= TIMELINE_DISJOINT;
973 db_multi_exec("%s", blob_str(&sql));
974 }else if( (p_rid || d_rid) && g.perm.Read ){
975 /* If p= or d= is present, ignore all other parameters other than n= */
976 char *zUuid;
977 int np, nd;
978
979 if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
1005 blob_appendf(&desc, "%d ancestors", np);
1006 db_multi_exec("%s", blob_str(&sql));
1007 }
1008 if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1009 }
1010 if( g.perm.History ){
1011 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
1012 g.zTop, zUuid, zUuid);
1013 }else{
1014 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
1015 }
1016 }else if( f_rid && g.perm.Read ){
1017 /* If f= is present, ignore all other parameters other than n= */
1018 char *zUuid;
1019 db_multi_exec(
1020 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
1021 "INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
1026 blob_appendf(&sql, " AND event.objid IN ok");
1027 db_multi_exec("%s", blob_str(&sql));
1028 if( useDividers ) timeline_add_dividers(0, f_rid);
1029 blob_appendf(&desc, "Parents and children of check-in ");
1030 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031 if( g.perm.History ){
1032 blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
1033 g.zTop, zUuid, zUuid);
1034 }else{
1035 blob_appendf(&desc, "[%.10s]", zUuid);
1036 }
@@ -1071,30 +1071,30 @@
1071 }else{
1072 url_add_parameter(&url, "t", zTagName);
1073 }
1074 blob_appendf(&sql, ")");
1075 }
1076 if( (zType[0]=='w' && !g.perm.RdWiki)
1077 || (zType[0]=='t' && !g.perm.RdTkt)
1078 || (zType[0]=='e' && !g.perm.RdWiki)
1079 || (zType[0]=='c' && !g.perm.Read)
1080 ){
1081 zType = "all";
1082 }
1083 if( zType[0]=='a' ){
1084 if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){
1085 char cSep = '(';
1086 blob_appendf(&sql, " AND event.type IN ");
1087 if( g.perm.Read ){
1088 blob_appendf(&sql, "%c'ci'", cSep);
1089 cSep = ',';
1090 }
1091 if( g.perm.RdWiki ){
1092 blob_appendf(&sql, "%c'w','e'", cSep);
1093 cSep = ',';
1094 }
1095 if( g.perm.RdTkt ){
1096 blob_appendf(&sql, "%c't'", cSep);
1097 cSep = ',';
1098 }
1099 blob_appendf(&sql, ")");
1100 }
@@ -1200,11 +1200,11 @@
1200 blob_appendf(&desc, " occurring around %h.<br />", zCirca);
1201 }
1202 if( zSearch ){
1203 blob_appendf(&desc, " matching \"%h\"", zSearch);
1204 }
1205 if( g.perm.History ){
1206 if( zAfter || n==nEntry ){
1207 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1208 timeline_submenu(&url, "Older", "b", zDate, "a");
1209 free(zDate);
1210 }
@@ -1214,20 +1214,20 @@
1214 free(zDate);
1215 }else if( tagid==0 ){
1216 if( zType[0]!='a' ){
1217 timeline_submenu(&url, "All Types", "y", "all", 0);
1218 }
1219 if( zType[0]!='w' && g.perm.RdWiki ){
1220 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
1221 }
1222 if( zType[0]!='c' && g.perm.Read ){
1223 timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
1224 }
1225 if( zType[0]!='t' && g.perm.RdTkt ){
1226 timeline_submenu(&url, "Tickets Only", "y", "t", 0);
1227 }
1228 if( zType[0]!='e' && g.perm.RdWiki ){
1229 timeline_submenu(&url, "Events Only", "y", "e", 0);
1230 }
1231 }
1232 if( nEntry>20 ){
1233 timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
1602 */
1603 void test_timewarp_page(void){
1604 Stmt q;
1605
1606 login_check_credentials();
1607 if( !g.perm.Read || !g.perm.History ){ login_needed(); return; }
1608 style_header("Instances of timewarp");
1609 @ <ul>
1610 db_prepare(&q,
1611 "SELECT blob.uuid "
1612 " FROM plink p, plink c, blob"
1613
+12 -12
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
8989
**
9090
** Only load those fields which do not already exist as
9191
** variables.
9292
**
9393
** Fields of the TICKET table that begin with "private_" are
94
-** expanded using the db_reveal() function. If g.okRdAddr is
94
+** expanded using the db_reveal() function. If g.perm.RdAddr is
9595
** true, then the db_reveal() function will decode the content
9696
** using the CONCEALED table so that the content legable.
9797
** Otherwise, db_reveal() is a no-op and the content remains
9898
** obscured.
9999
*/
@@ -292,28 +292,28 @@
292292
const char *zScript;
293293
char *zFullName;
294294
const char *zUuid = PD("name","");
295295
296296
login_check_credentials();
297
- if( !g.okRdTkt ){ login_needed(); return; }
298
- if( g.okWrTkt || g.okApndTkt ){
297
+ if( !g.perm.RdTkt ){ login_needed(); return; }
298
+ if( g.perm.WrTkt || g.perm.ApndTkt ){
299299
style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300300
g.zTop, PD("name",""));
301301
}
302
- if( g.okHistory ){
302
+ if( g.perm.History ){
303303
style_submenu_element("History", "History Of This Ticket",
304304
"%s/tkthistory/%T", g.zTop, zUuid);
305305
style_submenu_element("Timeline", "Timeline Of This Ticket",
306306
"%s/tkttimeline/%T", g.zTop, zUuid);
307307
style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308308
"%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309309
}
310
- if( g.okNewTkt ){
310
+ if( g.perm.NewTkt ){
311311
style_submenu_element("New Ticket", "Create a new ticket",
312312
"%s/tktnew", g.zTop);
313313
}
314
- if( g.okApndTkt && g.okAttach ){
314
+ if( g.perm.ApndTkt && g.perm.Attach ){
315315
style_submenu_element("Attach", "Add An Attachment",
316316
"%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317317
g.zTop, zUuid, g.zTop, zUuid);
318318
}
319319
style_header("View Ticket");
@@ -345,19 +345,19 @@
345345
@ <hr /><h2>Attachments:</h2>
346346
@ <ul>
347347
}
348348
cnt++;
349349
@ <li>
350
- if( g.okRead && g.okHistory ){
350
+ if( g.perm.Read && g.perm.History ){
351351
@ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352352
@ %h(zFile)</a>
353353
}else{
354354
@ %h(zFile)
355355
}
356356
@ added by %h(zUser) on
357357
hyperlink_to_date(zDate, ".");
358
- if( g.okWrTkt && g.okAttach ){
358
+ if( g.perm.WrTkt && g.perm.Attach ){
359359
@ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360360
}
361361
@ </li>
362362
}
363363
if( cnt ){
@@ -510,11 +510,11 @@
510510
void tktnew_page(void){
511511
const char *zScript;
512512
char *zNewUuid = 0;
513513
514514
login_check_credentials();
515
- if( !g.okNewTkt ){ login_needed(); return; }
515
+ if( !g.perm.NewTkt ){ login_needed(); return; }
516516
if( P("cancel") ){
517517
cgi_redirect("home");
518518
}
519519
style_header("New Ticket");
520520
if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556556
int nName;
557557
const char *zName;
558558
int nRec;
559559
560560
login_check_credentials();
561
- if( !g.okApndTkt && !g.okWrTkt ){ login_needed(); return; }
561
+ if( !g.perm.ApndTkt && !g.perm.WrTkt ){ login_needed(); return; }
562562
zName = P("name");
563563
if( P("cancel") ){
564564
cgi_redirectf("tktview?name=%T", zName);
565565
}
566566
style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651651
int tagid;
652652
char zGlobPattern[50];
653653
const char *zType;
654654
655655
login_check_credentials();
656
- if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
656
+ if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
657657
zUuid = PD("name","");
658658
zType = PD("y","a");
659659
if( zType[0]!='c' ){
660660
style_submenu_element("Check-ins", "Check-ins",
661661
"%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725725
char *zTitle;
726726
const char *zUuid;
727727
int tagid;
728728
729729
login_check_credentials();
730
- if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
730
+ if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
731731
zUuid = PD("name","");
732732
zTitle = mprintf("History Of Ticket %h", zUuid);
733733
style_submenu_element("Status", "Status",
734734
"%s/info/%s", g.zTop, zUuid);
735735
style_submenu_element("Check-ins", "Check-ins",
736736
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
89 **
90 ** Only load those fields which do not already exist as
91 ** variables.
92 **
93 ** Fields of the TICKET table that begin with "private_" are
94 ** expanded using the db_reveal() function. If g.okRdAddr is
95 ** true, then the db_reveal() function will decode the content
96 ** using the CONCEALED table so that the content legable.
97 ** Otherwise, db_reveal() is a no-op and the content remains
98 ** obscured.
99 */
@@ -292,28 +292,28 @@
292 const char *zScript;
293 char *zFullName;
294 const char *zUuid = PD("name","");
295
296 login_check_credentials();
297 if( !g.okRdTkt ){ login_needed(); return; }
298 if( g.okWrTkt || g.okApndTkt ){
299 style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300 g.zTop, PD("name",""));
301 }
302 if( g.okHistory ){
303 style_submenu_element("History", "History Of This Ticket",
304 "%s/tkthistory/%T", g.zTop, zUuid);
305 style_submenu_element("Timeline", "Timeline Of This Ticket",
306 "%s/tkttimeline/%T", g.zTop, zUuid);
307 style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308 "%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309 }
310 if( g.okNewTkt ){
311 style_submenu_element("New Ticket", "Create a new ticket",
312 "%s/tktnew", g.zTop);
313 }
314 if( g.okApndTkt && g.okAttach ){
315 style_submenu_element("Attach", "Add An Attachment",
316 "%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317 g.zTop, zUuid, g.zTop, zUuid);
318 }
319 style_header("View Ticket");
@@ -345,19 +345,19 @@
345 @ <hr /><h2>Attachments:</h2>
346 @ <ul>
347 }
348 cnt++;
349 @ <li>
350 if( g.okRead && g.okHistory ){
351 @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352 @ %h(zFile)</a>
353 }else{
354 @ %h(zFile)
355 }
356 @ added by %h(zUser) on
357 hyperlink_to_date(zDate, ".");
358 if( g.okWrTkt && g.okAttach ){
359 @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360 }
361 @ </li>
362 }
363 if( cnt ){
@@ -510,11 +510,11 @@
510 void tktnew_page(void){
511 const char *zScript;
512 char *zNewUuid = 0;
513
514 login_check_credentials();
515 if( !g.okNewTkt ){ login_needed(); return; }
516 if( P("cancel") ){
517 cgi_redirect("home");
518 }
519 style_header("New Ticket");
520 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556 int nName;
557 const char *zName;
558 int nRec;
559
560 login_check_credentials();
561 if( !g.okApndTkt && !g.okWrTkt ){ login_needed(); return; }
562 zName = P("name");
563 if( P("cancel") ){
564 cgi_redirectf("tktview?name=%T", zName);
565 }
566 style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651 int tagid;
652 char zGlobPattern[50];
653 const char *zType;
654
655 login_check_credentials();
656 if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
657 zUuid = PD("name","");
658 zType = PD("y","a");
659 if( zType[0]!='c' ){
660 style_submenu_element("Check-ins", "Check-ins",
661 "%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725 char *zTitle;
726 const char *zUuid;
727 int tagid;
728
729 login_check_credentials();
730 if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
731 zUuid = PD("name","");
732 zTitle = mprintf("History Of Ticket %h", zUuid);
733 style_submenu_element("Status", "Status",
734 "%s/info/%s", g.zTop, zUuid);
735 style_submenu_element("Check-ins", "Check-ins",
736
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
89 **
90 ** Only load those fields which do not already exist as
91 ** variables.
92 **
93 ** Fields of the TICKET table that begin with "private_" are
94 ** expanded using the db_reveal() function. If g.perm.RdAddr is
95 ** true, then the db_reveal() function will decode the content
96 ** using the CONCEALED table so that the content legable.
97 ** Otherwise, db_reveal() is a no-op and the content remains
98 ** obscured.
99 */
@@ -292,28 +292,28 @@
292 const char *zScript;
293 char *zFullName;
294 const char *zUuid = PD("name","");
295
296 login_check_credentials();
297 if( !g.perm.RdTkt ){ login_needed(); return; }
298 if( g.perm.WrTkt || g.perm.ApndTkt ){
299 style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300 g.zTop, PD("name",""));
301 }
302 if( g.perm.History ){
303 style_submenu_element("History", "History Of This Ticket",
304 "%s/tkthistory/%T", g.zTop, zUuid);
305 style_submenu_element("Timeline", "Timeline Of This Ticket",
306 "%s/tkttimeline/%T", g.zTop, zUuid);
307 style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308 "%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309 }
310 if( g.perm.NewTkt ){
311 style_submenu_element("New Ticket", "Create a new ticket",
312 "%s/tktnew", g.zTop);
313 }
314 if( g.perm.ApndTkt && g.perm.Attach ){
315 style_submenu_element("Attach", "Add An Attachment",
316 "%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317 g.zTop, zUuid, g.zTop, zUuid);
318 }
319 style_header("View Ticket");
@@ -345,19 +345,19 @@
345 @ <hr /><h2>Attachments:</h2>
346 @ <ul>
347 }
348 cnt++;
349 @ <li>
350 if( g.perm.Read && g.perm.History ){
351 @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352 @ %h(zFile)</a>
353 }else{
354 @ %h(zFile)
355 }
356 @ added by %h(zUser) on
357 hyperlink_to_date(zDate, ".");
358 if( g.perm.WrTkt && g.perm.Attach ){
359 @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360 }
361 @ </li>
362 }
363 if( cnt ){
@@ -510,11 +510,11 @@
510 void tktnew_page(void){
511 const char *zScript;
512 char *zNewUuid = 0;
513
514 login_check_credentials();
515 if( !g.perm.NewTkt ){ login_needed(); return; }
516 if( P("cancel") ){
517 cgi_redirect("home");
518 }
519 style_header("New Ticket");
520 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556 int nName;
557 const char *zName;
558 int nRec;
559
560 login_check_credentials();
561 if( !g.perm.ApndTkt && !g.perm.WrTkt ){ login_needed(); return; }
562 zName = P("name");
563 if( P("cancel") ){
564 cgi_redirectf("tktview?name=%T", zName);
565 }
566 style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651 int tagid;
652 char zGlobPattern[50];
653 const char *zType;
654
655 login_check_credentials();
656 if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
657 zUuid = PD("name","");
658 zType = PD("y","a");
659 if( zType[0]!='c' ){
660 style_submenu_element("Check-ins", "Check-ins",
661 "%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725 char *zTitle;
726 const char *zUuid;
727 int tagid;
728
729 login_check_credentials();
730 if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
731 zUuid = PD("name","");
732 zTitle = mprintf("History Of Ticket %h", zUuid);
733 style_submenu_element("Status", "Status",
734 "%s/info/%s", g.zTop, zUuid);
735 style_submenu_element("Check-ins", "Check-ins",
736
+3 -3
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
2626
** Main sub-menu for configuring the ticketing system.
2727
** WEBPAGE: tktsetup
2828
*/
2929
void tktsetup_page(void){
3030
login_check_credentials();
31
- if( !g.okSetup ){
31
+ if( !g.perm.Setup ){
3232
login_needed();
3333
}
3434
3535
style_header("Ticket Setup");
3636
@ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102102
){
103103
const char *z;
104104
int isSubmit;
105105
106106
login_check_credentials();
107
- if( !g.okSetup ){
107
+ if( !g.perm.Setup ){
108108
login_needed();
109109
}
110110
if( P("setup") ){
111111
cgi_redirect("tktsetup");
112112
}
@@ -690,11 +690,11 @@
690690
/*
691691
** WEBPAGE: tktsetup_timeline
692692
*/
693693
void tktsetup_timeline_page(void){
694694
login_check_credentials();
695
- if( !g.okSetup ){
695
+ if( !g.perm.Setup ){
696696
login_needed();
697697
}
698698
699699
if( P("setup") ){
700700
cgi_redirect("tktsetup");
701701
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
26 ** Main sub-menu for configuring the ticketing system.
27 ** WEBPAGE: tktsetup
28 */
29 void tktsetup_page(void){
30 login_check_credentials();
31 if( !g.okSetup ){
32 login_needed();
33 }
34
35 style_header("Ticket Setup");
36 @ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102 ){
103 const char *z;
104 int isSubmit;
105
106 login_check_credentials();
107 if( !g.okSetup ){
108 login_needed();
109 }
110 if( P("setup") ){
111 cgi_redirect("tktsetup");
112 }
@@ -690,11 +690,11 @@
690 /*
691 ** WEBPAGE: tktsetup_timeline
692 */
693 void tktsetup_timeline_page(void){
694 login_check_credentials();
695 if( !g.okSetup ){
696 login_needed();
697 }
698
699 if( P("setup") ){
700 cgi_redirect("tktsetup");
701
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
26 ** Main sub-menu for configuring the ticketing system.
27 ** WEBPAGE: tktsetup
28 */
29 void tktsetup_page(void){
30 login_check_credentials();
31 if( !g.perm.Setup ){
32 login_needed();
33 }
34
35 style_header("Ticket Setup");
36 @ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102 ){
103 const char *z;
104 int isSubmit;
105
106 login_check_credentials();
107 if( !g.perm.Setup ){
108 login_needed();
109 }
110 if( P("setup") ){
111 cgi_redirect("tktsetup");
112 }
@@ -690,11 +690,11 @@
690 /*
691 ** WEBPAGE: tktsetup_timeline
692 */
693 void tktsetup_timeline_page(void){
694 login_check_credentials();
695 if( !g.perm.Setup ){
696 login_needed();
697 }
698
699 if( P("setup") ){
700 cgi_redirect("tktsetup");
701
+7 -2
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350350
351351
/*
352352
** COMMAND: undo
353353
** COMMAND: redo
354354
**
355
-** Usage: %fossil undo ?--explain? ?FILENAME...?
356
-** or: %fossil redo ?--explain? ?FILENAME...?
355
+** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
356
+** or: %fossil redo ?OPTIONS? ?FILENAME...?
357357
**
358358
** Undo the changes to the working checkout caused by the most recent
359359
** of the following operations:
360360
**
361361
** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371371
** the undo or redo command explains what actions the undo or redo would
372372
** have done had the --explain been omitted.
373373
**
374374
** A single level of undo/redo is supported. The undo/redo stack
375375
** is cleared by the commit and checkout commands.
376
+**
377
+** Options:
378
+** --explain do not make changes but show what would be done
379
+**
380
+** See also: commit, status
376381
*/
377382
void undo_cmd(void){
378383
int isRedo = g.argv[1][0]=='r';
379384
int undo_available;
380385
int explainFlag = find_option("explain", 0, 0)!=0;
381386
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350
351 /*
352 ** COMMAND: undo
353 ** COMMAND: redo
354 **
355 ** Usage: %fossil undo ?--explain? ?FILENAME...?
356 ** or: %fossil redo ?--explain? ?FILENAME...?
357 **
358 ** Undo the changes to the working checkout caused by the most recent
359 ** of the following operations:
360 **
361 ** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371 ** the undo or redo command explains what actions the undo or redo would
372 ** have done had the --explain been omitted.
373 **
374 ** A single level of undo/redo is supported. The undo/redo stack
375 ** is cleared by the commit and checkout commands.
 
 
 
 
 
376 */
377 void undo_cmd(void){
378 int isRedo = g.argv[1][0]=='r';
379 int undo_available;
380 int explainFlag = find_option("explain", 0, 0)!=0;
381
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350
351 /*
352 ** COMMAND: undo
353 ** COMMAND: redo
354 **
355 ** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
356 ** or: %fossil redo ?OPTIONS? ?FILENAME...?
357 **
358 ** Undo the changes to the working checkout caused by the most recent
359 ** of the following operations:
360 **
361 ** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371 ** the undo or redo command explains what actions the undo or redo would
372 ** have done had the --explain been omitted.
373 **
374 ** A single level of undo/redo is supported. The undo/redo stack
375 ** is cleared by the commit and checkout commands.
376 **
377 ** Options:
378 ** --explain do not make changes but show what would be done
379 **
380 ** See also: commit, status
381 */
382 void undo_cmd(void){
383 int isRedo = g.argv[1][0]=='r';
384 int undo_available;
385 int explainFlag = find_option("explain", 0, 0)!=0;
386
+7 -2
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350350
351351
/*
352352
** COMMAND: undo
353353
** COMMAND: redo
354354
**
355
-** Usage: %fossil undo ?--explain? ?FILENAME...?
356
-** or: %fossil redo ?--explain? ?FILENAME...?
355
+** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
356
+** or: %fossil redo ?OPTIONS? ?FILENAME...?
357357
**
358358
** Undo the changes to the working checkout caused by the most recent
359359
** of the following operations:
360360
**
361361
** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371371
** the undo or redo command explains what actions the undo or redo would
372372
** have done had the --explain been omitted.
373373
**
374374
** A single level of undo/redo is supported. The undo/redo stack
375375
** is cleared by the commit and checkout commands.
376
+**
377
+** Options:
378
+** --explain do not make changes but show what would be done
379
+**
380
+** See also: commit, status
376381
*/
377382
void undo_cmd(void){
378383
int isRedo = g.argv[1][0]=='r';
379384
int undo_available;
380385
int explainFlag = find_option("explain", 0, 0)!=0;
381386
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350
351 /*
352 ** COMMAND: undo
353 ** COMMAND: redo
354 **
355 ** Usage: %fossil undo ?--explain? ?FILENAME...?
356 ** or: %fossil redo ?--explain? ?FILENAME...?
357 **
358 ** Undo the changes to the working checkout caused by the most recent
359 ** of the following operations:
360 **
361 ** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371 ** the undo or redo command explains what actions the undo or redo would
372 ** have done had the --explain been omitted.
373 **
374 ** A single level of undo/redo is supported. The undo/redo stack
375 ** is cleared by the commit and checkout commands.
 
 
 
 
 
376 */
377 void undo_cmd(void){
378 int isRedo = g.argv[1][0]=='r';
379 int undo_available;
380 int explainFlag = find_option("explain", 0, 0)!=0;
381
--- src/undo.c
+++ src/undo.c
@@ -350,12 +350,12 @@
350
351 /*
352 ** COMMAND: undo
353 ** COMMAND: redo
354 **
355 ** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
356 ** or: %fossil redo ?OPTIONS? ?FILENAME...?
357 **
358 ** Undo the changes to the working checkout caused by the most recent
359 ** of the following operations:
360 **
361 ** (1) fossil update (5) fossil stash apply
@@ -371,10 +371,15 @@
371 ** the undo or redo command explains what actions the undo or redo would
372 ** have done had the --explain been omitted.
373 **
374 ** A single level of undo/redo is supported. The undo/redo stack
375 ** is cleared by the commit and checkout commands.
376 **
377 ** Options:
378 ** --explain do not make changes but show what would be done
379 **
380 ** See also: commit, status
381 */
382 void undo_cmd(void){
383 int isRedo = g.argv[1][0]=='r';
384 int undo_available;
385 int explainFlag = find_option("explain", 0, 0)!=0;
386
+14 -1
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
6060
}
6161
6262
/*
6363
** COMMAND: update
6464
**
65
-** Usage: %fossil update ?VERSION? ?FILES...?
65
+** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...?
6666
**
6767
** Change the version of the current checkout to VERSION. Any uncommitted
6868
** changes are retained and applied to the new checkout.
6969
**
7070
** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
8383
** prints out what would have happened but does not actually make any
8484
** changes to the current checkout or the repository.
8585
**
8686
** The -v or --verbose option prints status information about unchanged
8787
** files in addition to those file that actually do change.
88
+**
89
+** Options:
90
+** --debug print debug information on stdout
91
+** --latest acceptable in place of VERSION, update to latest version
92
+** -n|--nochange do not perform changes but show what would be done
93
+** -v|--verbose print status information about all files
94
+**
95
+** See also: revert
8896
*/
8997
void update_cmd(void){
9098
int vid; /* Current version */
9199
int tid=0; /* Target version - version we are changing to */
92100
Stmt q;
@@ -599,10 +607,15 @@
599607
**
600608
** Revert all files if no file name is provided.
601609
**
602610
** If a file is reverted accidently, it can be restored using
603611
** the "fossil undo" command.
612
+**
613
+** Options:
614
+** -r REVISION revert given FILE(s) back to given REVISION
615
+**
616
+** See also: redo, undo, update
604617
*/
605618
void revert_cmd(void){
606619
const char *zFile;
607620
const char *zRevision;
608621
Blob record;
609622
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
60 }
61
62 /*
63 ** COMMAND: update
64 **
65 ** Usage: %fossil update ?VERSION? ?FILES...?
66 **
67 ** Change the version of the current checkout to VERSION. Any uncommitted
68 ** changes are retained and applied to the new checkout.
69 **
70 ** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
83 ** prints out what would have happened but does not actually make any
84 ** changes to the current checkout or the repository.
85 **
86 ** The -v or --verbose option prints status information about unchanged
87 ** files in addition to those file that actually do change.
 
 
 
 
 
 
 
 
88 */
89 void update_cmd(void){
90 int vid; /* Current version */
91 int tid=0; /* Target version - version we are changing to */
92 Stmt q;
@@ -599,10 +607,15 @@
599 **
600 ** Revert all files if no file name is provided.
601 **
602 ** If a file is reverted accidently, it can be restored using
603 ** the "fossil undo" command.
 
 
 
 
 
604 */
605 void revert_cmd(void){
606 const char *zFile;
607 const char *zRevision;
608 Blob record;
609
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
60 }
61
62 /*
63 ** COMMAND: update
64 **
65 ** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...?
66 **
67 ** Change the version of the current checkout to VERSION. Any uncommitted
68 ** changes are retained and applied to the new checkout.
69 **
70 ** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
83 ** prints out what would have happened but does not actually make any
84 ** changes to the current checkout or the repository.
85 **
86 ** The -v or --verbose option prints status information about unchanged
87 ** files in addition to those file that actually do change.
88 **
89 ** Options:
90 ** --debug print debug information on stdout
91 ** --latest acceptable in place of VERSION, update to latest version
92 ** -n|--nochange do not perform changes but show what would be done
93 ** -v|--verbose print status information about all files
94 **
95 ** See also: revert
96 */
97 void update_cmd(void){
98 int vid; /* Current version */
99 int tid=0; /* Target version - version we are changing to */
100 Stmt q;
@@ -599,10 +607,15 @@
607 **
608 ** Revert all files if no file name is provided.
609 **
610 ** If a file is reverted accidently, it can be restored using
611 ** the "fossil undo" command.
612 **
613 ** Options:
614 ** -r REVISION revert given FILE(s) back to given REVISION
615 **
616 ** See also: redo, undo, update
617 */
618 void revert_cmd(void){
619 const char *zFile;
620 const char *zRevision;
621 Blob record;
622
+14 -1
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
6060
}
6161
6262
/*
6363
** COMMAND: update
6464
**
65
-** Usage: %fossil update ?VERSION? ?FILES...?
65
+** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...?
6666
**
6767
** Change the version of the current checkout to VERSION. Any uncommitted
6868
** changes are retained and applied to the new checkout.
6969
**
7070
** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
8383
** prints out what would have happened but does not actually make any
8484
** changes to the current checkout or the repository.
8585
**
8686
** The -v or --verbose option prints status information about unchanged
8787
** files in addition to those file that actually do change.
88
+**
89
+** Options:
90
+** --debug print debug information on stdout
91
+** --latest acceptable in place of VERSION, update to latest version
92
+** -n|--nochange do not perform changes but show what would be done
93
+** -v|--verbose print status information about all files
94
+**
95
+** See also: revert
8896
*/
8997
void update_cmd(void){
9098
int vid; /* Current version */
9199
int tid=0; /* Target version - version we are changing to */
92100
Stmt q;
@@ -599,10 +607,15 @@
599607
**
600608
** Revert all files if no file name is provided.
601609
**
602610
** If a file is reverted accidently, it can be restored using
603611
** the "fossil undo" command.
612
+**
613
+** Options:
614
+** -r REVISION revert given FILE(s) back to given REVISION
615
+**
616
+** See also: redo, undo, update
604617
*/
605618
void revert_cmd(void){
606619
const char *zFile;
607620
const char *zRevision;
608621
Blob record;
609622
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
60 }
61
62 /*
63 ** COMMAND: update
64 **
65 ** Usage: %fossil update ?VERSION? ?FILES...?
66 **
67 ** Change the version of the current checkout to VERSION. Any uncommitted
68 ** changes are retained and applied to the new checkout.
69 **
70 ** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
83 ** prints out what would have happened but does not actually make any
84 ** changes to the current checkout or the repository.
85 **
86 ** The -v or --verbose option prints status information about unchanged
87 ** files in addition to those file that actually do change.
 
 
 
 
 
 
 
 
88 */
89 void update_cmd(void){
90 int vid; /* Current version */
91 int tid=0; /* Target version - version we are changing to */
92 Stmt q;
@@ -599,10 +607,15 @@
599 **
600 ** Revert all files if no file name is provided.
601 **
602 ** If a file is reverted accidently, it can be restored using
603 ** the "fossil undo" command.
 
 
 
 
 
604 */
605 void revert_cmd(void){
606 const char *zFile;
607 const char *zRevision;
608 Blob record;
609
--- src/update.c
+++ src/update.c
@@ -60,11 +60,11 @@
60 }
61
62 /*
63 ** COMMAND: update
64 **
65 ** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...?
66 **
67 ** Change the version of the current checkout to VERSION. Any uncommitted
68 ** changes are retained and applied to the new checkout.
69 **
70 ** The VERSION argument can be a specific version or tag or branch name.
@@ -83,10 +83,18 @@
83 ** prints out what would have happened but does not actually make any
84 ** changes to the current checkout or the repository.
85 **
86 ** The -v or --verbose option prints status information about unchanged
87 ** files in addition to those file that actually do change.
88 **
89 ** Options:
90 ** --debug print debug information on stdout
91 ** --latest acceptable in place of VERSION, update to latest version
92 ** -n|--nochange do not perform changes but show what would be done
93 ** -v|--verbose print status information about all files
94 **
95 ** See also: revert
96 */
97 void update_cmd(void){
98 int vid; /* Current version */
99 int tid=0; /* Target version - version we are changing to */
100 Stmt q;
@@ -599,10 +607,15 @@
607 **
608 ** Revert all files if no file name is provided.
609 **
610 ** If a file is reverted accidently, it can be restored using
611 ** the "fossil undo" command.
612 **
613 ** Options:
614 ** -r REVISION revert given FILE(s) back to given REVISION
615 **
616 ** See also: redo, undo, update
617 */
618 void revert_cmd(void){
619 const char *zFile;
620 const char *zRevision;
621 Blob record;
622
+1 -1
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393393
Stmt q;
394394
int cnt = 0;
395395
int rc;
396396
397397
login_check_credentials();
398
- if( !g.okAdmin ){ login_needed(); return; }
398
+ if( !g.perm.Admin ){ login_needed(); return; }
399399
create_accesslog_table();
400400
401401
if( P("delall") && P("delallbtn") ){
402402
db_multi_exec("DELETE FROM accesslog");
403403
cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404404
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393 Stmt q;
394 int cnt = 0;
395 int rc;
396
397 login_check_credentials();
398 if( !g.okAdmin ){ login_needed(); return; }
399 create_accesslog_table();
400
401 if( P("delall") && P("delallbtn") ){
402 db_multi_exec("DELETE FROM accesslog");
403 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393 Stmt q;
394 int cnt = 0;
395 int rc;
396
397 login_check_credentials();
398 if( !g.perm.Admin ){ login_needed(); return; }
399 create_accesslog_table();
400
401 if( P("delall") && P("delallbtn") ){
402 db_multi_exec("DELETE FROM accesslog");
403 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404
+18 -18
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
9090
if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
9191
}
9292
if( zIndexPage ){
9393
cgi_redirectf("%s/%s", g.zTop, zIndexPage);
9494
}
95
- if( !g.okRdWiki ){
95
+ if( !g.perm.RdWiki ){
9696
cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
9797
}
9898
if( zPageName ){
9999
login_check_credentials();
100100
g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135135
char *zBody = mprintf("%s","<i>Empty Page</i>");
136136
Stmt q;
137137
int cnt = 0;
138138
139139
login_check_credentials();
140
- if( !g.okRdWiki ){ login_needed(); return; }
140
+ if( !g.perm.RdWiki ){ login_needed(); return; }
141141
zPageName = P("name");
142142
if( zPageName==0 ){
143143
style_header("Wiki");
144144
@ <ul>
145145
{ char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152152
@ pages. </li>
153153
@ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154154
@ wiki.</li>
155155
@ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156156
@ to experiment.</li>
157
- if( g.okNewWiki ){
157
+ if( g.perm.NewWiki ){
158158
@ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159
- if( g.okWrite ){
159
+ if( g.perm.Write ){
160160
@ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161161
}
162162
}
163163
@ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164164
@ available on this server.</li>
@@ -186,24 +186,24 @@
186186
if( pWiki ){
187187
zBody = pWiki->zWiki;
188188
}
189189
}
190190
if( !g.isHome ){
191
- if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
191
+ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){
192192
style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193193
g.zTop, zPageName);
194194
}
195
- if( rid && g.okApndWiki && g.okAttach ){
195
+ if( rid && g.perm.ApndWiki && g.perm.Attach ){
196196
style_submenu_element("Attach", "Add An Attachment",
197197
"%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198198
g.zTop, zPageName, g.zTop, zPageName);
199199
}
200
- if( rid && g.okApndWiki ){
200
+ if( rid && g.perm.ApndWiki ){
201201
style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202202
g.zTop, zPageName);
203203
}
204
- if( g.okHistory ){
204
+ if( g.perm.History ){
205205
style_submenu_element("History", "History", "%s/whistory?name=%T",
206206
g.zTop, zPageName);
207207
}
208208
}
209209
style_header(zPageName);
@@ -225,19 +225,19 @@
225225
@ <hr /><h2>Attachments:</h2>
226226
@ <ul>
227227
}
228228
cnt++;
229229
@ <li>
230
- if( g.okHistory && g.okRead ){
230
+ if( g.perm.History && g.perm.Read ){
231231
@ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232232
@ %h(zFile)</a>
233233
}else{
234234
@ <li>%h(zFile)
235235
}
236236
@ added by %h(zUser) on
237237
hyperlink_to_date(zDate, ".");
238
- if( g.okWrWiki && g.okAttach ){
238
+ if( g.perm.WrWiki && g.perm.Attach ){
239239
@ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240240
}
241241
@ </li>
242242
}
243243
if( cnt ){
@@ -271,11 +271,11 @@
271271
login_check_credentials();
272272
zPageName = PD("name","");
273273
if( check_name(zPageName) ) return;
274274
isSandbox = is_sandbox(zPageName);
275275
if( isSandbox ){
276
- if( !g.okWrWiki ){
276
+ if( !g.perm.WrWiki ){
277277
login_needed();
278278
return;
279279
}
280280
if( zBody==0 ){
281281
zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286286
"SELECT rid FROM tagxref"
287287
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288288
" ORDER BY mtime DESC", zTag
289289
);
290290
free(zTag);
291
- if( (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
291
+ if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
292292
login_needed();
293293
return;
294294
}
295295
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296296
zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375375
** to the wikiedit screen for that new page.
376376
*/
377377
void wikinew_page(void){
378378
const char *zName;
379379
login_check_credentials();
380
- if( !g.okNewWiki ){
380
+ if( !g.perm.NewWiki ){
381381
login_needed();
382382
return;
383383
}
384384
zName = PD("name","");
385385
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450450
if( !rid ){
451451
fossil_redirect_home();
452452
return;
453453
}
454454
}
455
- if( !g.okApndWiki ){
455
+ if( !g.perm.ApndWiki ){
456456
login_needed();
457457
return;
458458
}
459459
if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460460
char *zDate;
@@ -560,11 +560,11 @@
560560
Stmt q;
561561
char *zTitle;
562562
char *zSQL;
563563
const char *zPageName;
564564
login_check_credentials();
565
- if( !g.okHistory ){ login_needed(); return; }
565
+ if( !g.perm.History ){ login_needed(); return; }
566566
zPageName = PD("name","");
567567
zTitle = mprintf("History Of %s", zPageName);
568568
style_header(zTitle);
569569
free(zTitle);
570570
@@ -596,11 +596,11 @@
596596
Manifest *pW1, *pW2 = 0;
597597
Blob w1, w2, d;
598598
599599
login_check_credentials();
600600
rid1 = atoi(PD("a","0"));
601
- if( !g.okHistory ){ login_needed(); return; }
601
+ if( !g.perm.History ){ login_needed(); return; }
602602
if( rid1==0 ) fossil_redirect_home();
603603
rid2 = atoi(PD("b","0"));
604604
zPageName = PD("name","");
605605
zTitle = mprintf("Changes To %s", zPageName);
606606
style_header(zTitle);
@@ -642,11 +642,11 @@
642642
void wcontent_page(void){
643643
Stmt q;
644644
int showAll = P("all")!=0;
645645
646646
login_check_credentials();
647
- if( !g.okRdWiki ){ login_needed(); return; }
647
+ if( !g.perm.RdWiki ){ login_needed(); return; }
648648
style_header("Available Wiki Pages");
649649
if( showAll ){
650650
style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651651
}else{
652652
style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681681
*/
682682
void wfind_page(void){
683683
Stmt q;
684684
const char * zTitle;
685685
login_check_credentials();
686
- if( !g.okRdWiki ){ login_needed(); return; }
686
+ if( !g.perm.RdWiki ){ login_needed(); return; }
687687
zTitle = PD("title","*");
688688
style_header("Wiki Pages Found");
689689
@ <ul>
690690
db_prepare(&q,
691691
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692692
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
90 if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
91 }
92 if( zIndexPage ){
93 cgi_redirectf("%s/%s", g.zTop, zIndexPage);
94 }
95 if( !g.okRdWiki ){
96 cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
97 }
98 if( zPageName ){
99 login_check_credentials();
100 g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135 char *zBody = mprintf("%s","<i>Empty Page</i>");
136 Stmt q;
137 int cnt = 0;
138
139 login_check_credentials();
140 if( !g.okRdWiki ){ login_needed(); return; }
141 zPageName = P("name");
142 if( zPageName==0 ){
143 style_header("Wiki");
144 @ <ul>
145 { char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152 @ pages. </li>
153 @ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154 @ wiki.</li>
155 @ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156 @ to experiment.</li>
157 if( g.okNewWiki ){
158 @ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159 if( g.okWrite ){
160 @ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161 }
162 }
163 @ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164 @ available on this server.</li>
@@ -186,24 +186,24 @@
186 if( pWiki ){
187 zBody = pWiki->zWiki;
188 }
189 }
190 if( !g.isHome ){
191 if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
192 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193 g.zTop, zPageName);
194 }
195 if( rid && g.okApndWiki && g.okAttach ){
196 style_submenu_element("Attach", "Add An Attachment",
197 "%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198 g.zTop, zPageName, g.zTop, zPageName);
199 }
200 if( rid && g.okApndWiki ){
201 style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202 g.zTop, zPageName);
203 }
204 if( g.okHistory ){
205 style_submenu_element("History", "History", "%s/whistory?name=%T",
206 g.zTop, zPageName);
207 }
208 }
209 style_header(zPageName);
@@ -225,19 +225,19 @@
225 @ <hr /><h2>Attachments:</h2>
226 @ <ul>
227 }
228 cnt++;
229 @ <li>
230 if( g.okHistory && g.okRead ){
231 @ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232 @ %h(zFile)</a>
233 }else{
234 @ <li>%h(zFile)
235 }
236 @ added by %h(zUser) on
237 hyperlink_to_date(zDate, ".");
238 if( g.okWrWiki && g.okAttach ){
239 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240 }
241 @ </li>
242 }
243 if( cnt ){
@@ -271,11 +271,11 @@
271 login_check_credentials();
272 zPageName = PD("name","");
273 if( check_name(zPageName) ) return;
274 isSandbox = is_sandbox(zPageName);
275 if( isSandbox ){
276 if( !g.okWrWiki ){
277 login_needed();
278 return;
279 }
280 if( zBody==0 ){
281 zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286 "SELECT rid FROM tagxref"
287 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288 " ORDER BY mtime DESC", zTag
289 );
290 free(zTag);
291 if( (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
292 login_needed();
293 return;
294 }
295 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296 zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375 ** to the wikiedit screen for that new page.
376 */
377 void wikinew_page(void){
378 const char *zName;
379 login_check_credentials();
380 if( !g.okNewWiki ){
381 login_needed();
382 return;
383 }
384 zName = PD("name","");
385 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450 if( !rid ){
451 fossil_redirect_home();
452 return;
453 }
454 }
455 if( !g.okApndWiki ){
456 login_needed();
457 return;
458 }
459 if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460 char *zDate;
@@ -560,11 +560,11 @@
560 Stmt q;
561 char *zTitle;
562 char *zSQL;
563 const char *zPageName;
564 login_check_credentials();
565 if( !g.okHistory ){ login_needed(); return; }
566 zPageName = PD("name","");
567 zTitle = mprintf("History Of %s", zPageName);
568 style_header(zTitle);
569 free(zTitle);
570
@@ -596,11 +596,11 @@
596 Manifest *pW1, *pW2 = 0;
597 Blob w1, w2, d;
598
599 login_check_credentials();
600 rid1 = atoi(PD("a","0"));
601 if( !g.okHistory ){ login_needed(); return; }
602 if( rid1==0 ) fossil_redirect_home();
603 rid2 = atoi(PD("b","0"));
604 zPageName = PD("name","");
605 zTitle = mprintf("Changes To %s", zPageName);
606 style_header(zTitle);
@@ -642,11 +642,11 @@
642 void wcontent_page(void){
643 Stmt q;
644 int showAll = P("all")!=0;
645
646 login_check_credentials();
647 if( !g.okRdWiki ){ login_needed(); return; }
648 style_header("Available Wiki Pages");
649 if( showAll ){
650 style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651 }else{
652 style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681 */
682 void wfind_page(void){
683 Stmt q;
684 const char * zTitle;
685 login_check_credentials();
686 if( !g.okRdWiki ){ login_needed(); return; }
687 zTitle = PD("title","*");
688 style_header("Wiki Pages Found");
689 @ <ul>
690 db_prepare(&q,
691 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
90 if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
91 }
92 if( zIndexPage ){
93 cgi_redirectf("%s/%s", g.zTop, zIndexPage);
94 }
95 if( !g.perm.RdWiki ){
96 cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
97 }
98 if( zPageName ){
99 login_check_credentials();
100 g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135 char *zBody = mprintf("%s","<i>Empty Page</i>");
136 Stmt q;
137 int cnt = 0;
138
139 login_check_credentials();
140 if( !g.perm.RdWiki ){ login_needed(); return; }
141 zPageName = P("name");
142 if( zPageName==0 ){
143 style_header("Wiki");
144 @ <ul>
145 { char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152 @ pages. </li>
153 @ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154 @ wiki.</li>
155 @ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156 @ to experiment.</li>
157 if( g.perm.NewWiki ){
158 @ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159 if( g.perm.Write ){
160 @ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161 }
162 }
163 @ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164 @ available on this server.</li>
@@ -186,24 +186,24 @@
186 if( pWiki ){
187 zBody = pWiki->zWiki;
188 }
189 }
190 if( !g.isHome ){
191 if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){
192 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193 g.zTop, zPageName);
194 }
195 if( rid && g.perm.ApndWiki && g.perm.Attach ){
196 style_submenu_element("Attach", "Add An Attachment",
197 "%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198 g.zTop, zPageName, g.zTop, zPageName);
199 }
200 if( rid && g.perm.ApndWiki ){
201 style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202 g.zTop, zPageName);
203 }
204 if( g.perm.History ){
205 style_submenu_element("History", "History", "%s/whistory?name=%T",
206 g.zTop, zPageName);
207 }
208 }
209 style_header(zPageName);
@@ -225,19 +225,19 @@
225 @ <hr /><h2>Attachments:</h2>
226 @ <ul>
227 }
228 cnt++;
229 @ <li>
230 if( g.perm.History && g.perm.Read ){
231 @ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232 @ %h(zFile)</a>
233 }else{
234 @ <li>%h(zFile)
235 }
236 @ added by %h(zUser) on
237 hyperlink_to_date(zDate, ".");
238 if( g.perm.WrWiki && g.perm.Attach ){
239 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240 }
241 @ </li>
242 }
243 if( cnt ){
@@ -271,11 +271,11 @@
271 login_check_credentials();
272 zPageName = PD("name","");
273 if( check_name(zPageName) ) return;
274 isSandbox = is_sandbox(zPageName);
275 if( isSandbox ){
276 if( !g.perm.WrWiki ){
277 login_needed();
278 return;
279 }
280 if( zBody==0 ){
281 zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286 "SELECT rid FROM tagxref"
287 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288 " ORDER BY mtime DESC", zTag
289 );
290 free(zTag);
291 if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
292 login_needed();
293 return;
294 }
295 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296 zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375 ** to the wikiedit screen for that new page.
376 */
377 void wikinew_page(void){
378 const char *zName;
379 login_check_credentials();
380 if( !g.perm.NewWiki ){
381 login_needed();
382 return;
383 }
384 zName = PD("name","");
385 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450 if( !rid ){
451 fossil_redirect_home();
452 return;
453 }
454 }
455 if( !g.perm.ApndWiki ){
456 login_needed();
457 return;
458 }
459 if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460 char *zDate;
@@ -560,11 +560,11 @@
560 Stmt q;
561 char *zTitle;
562 char *zSQL;
563 const char *zPageName;
564 login_check_credentials();
565 if( !g.perm.History ){ login_needed(); return; }
566 zPageName = PD("name","");
567 zTitle = mprintf("History Of %s", zPageName);
568 style_header(zTitle);
569 free(zTitle);
570
@@ -596,11 +596,11 @@
596 Manifest *pW1, *pW2 = 0;
597 Blob w1, w2, d;
598
599 login_check_credentials();
600 rid1 = atoi(PD("a","0"));
601 if( !g.perm.History ){ login_needed(); return; }
602 if( rid1==0 ) fossil_redirect_home();
603 rid2 = atoi(PD("b","0"));
604 zPageName = PD("name","");
605 zTitle = mprintf("Changes To %s", zPageName);
606 style_header(zTitle);
@@ -642,11 +642,11 @@
642 void wcontent_page(void){
643 Stmt q;
644 int showAll = P("all")!=0;
645
646 login_check_credentials();
647 if( !g.perm.RdWiki ){ login_needed(); return; }
648 style_header("Available Wiki Pages");
649 if( showAll ){
650 style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651 }else{
652 style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681 */
682 void wfind_page(void){
683 Stmt q;
684 const char * zTitle;
685 login_check_credentials();
686 if( !g.perm.RdWiki ){ login_needed(); return; }
687 zTitle = PD("title","*");
688 style_header("Wiki Pages Found");
689 @ <ul>
690 db_prepare(&q,
691 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
10431043
|| strncmp(zTarget, "mailto:", 7)==0
10441044
){
10451045
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
10461046
/* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
10471047
}else if( zTarget[0]=='/' ){
1048
- if( 1 /* g.okHistory */ ){
1048
+ if( 1 /* g.perm.History */ ){
10491049
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
10501050
}else{
10511051
zTerm = "";
10521052
}
10531053
}else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054
- if( 1 /* g.okHistory */ ){
1054
+ if( 1 /* g.perm.History */ ){
10551055
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
10561056
}else{
10571057
zTerm = "";
10581058
}
10591059
}else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
10611061
if( is_ticket(zTarget, &isClosed) ){
10621062
/* Special display processing for tickets. Display the hyperlink
10631063
** as crossed out if the ticket is closed.
10641064
*/
10651065
if( isClosed ){
1066
- if( g.okHistory ){
1066
+ if( g.perm.History ){
10671067
blob_appendf(p->pOut,
10681068
"<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
10691069
g.zTop, zTarget
10701070
);
10711071
zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
10721072
}else{
10731073
blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
10741074
zTerm = "]</span>";
10751075
}
10761076
}else{
1077
- if( g.okHistory ){
1077
+ if( g.perm.History ){
10781078
blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
10791079
g.zTop, zTarget
10801080
);
10811081
zTerm = "]</a>";
10821082
}else{
@@ -1085,11 +1085,11 @@
10851085
}
10861086
}
10871087
}else if( !in_this_repo(zTarget) ){
10881088
blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
10891089
zTerm = "]</span>";
1090
- }else if( g.okHistory ){
1090
+ }else if( g.perm.History ){
10911091
blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
10921092
zTerm = "]</a>";
10931093
}
10941094
}else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
10951095
&& db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
10961096
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
1043 || strncmp(zTarget, "mailto:", 7)==0
1044 ){
1045 blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
1046 /* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
1047 }else if( zTarget[0]=='/' ){
1048 if( 1 /* g.okHistory */ ){
1049 blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
1050 }else{
1051 zTerm = "";
1052 }
1053 }else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054 if( 1 /* g.okHistory */ ){
1055 blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
1056 }else{
1057 zTerm = "";
1058 }
1059 }else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
1061 if( is_ticket(zTarget, &isClosed) ){
1062 /* Special display processing for tickets. Display the hyperlink
1063 ** as crossed out if the ticket is closed.
1064 */
1065 if( isClosed ){
1066 if( g.okHistory ){
1067 blob_appendf(p->pOut,
1068 "<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
1069 g.zTop, zTarget
1070 );
1071 zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
1072 }else{
1073 blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
1074 zTerm = "]</span>";
1075 }
1076 }else{
1077 if( g.okHistory ){
1078 blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
1079 g.zTop, zTarget
1080 );
1081 zTerm = "]</a>";
1082 }else{
@@ -1085,11 +1085,11 @@
1085 }
1086 }
1087 }else if( !in_this_repo(zTarget) ){
1088 blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
1089 zTerm = "]</span>";
1090 }else if( g.okHistory ){
1091 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
1092 zTerm = "]</a>";
1093 }
1094 }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
1095 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1096
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
1043 || strncmp(zTarget, "mailto:", 7)==0
1044 ){
1045 blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
1046 /* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
1047 }else if( zTarget[0]=='/' ){
1048 if( 1 /* g.perm.History */ ){
1049 blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
1050 }else{
1051 zTerm = "";
1052 }
1053 }else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054 if( 1 /* g.perm.History */ ){
1055 blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
1056 }else{
1057 zTerm = "";
1058 }
1059 }else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
1061 if( is_ticket(zTarget, &isClosed) ){
1062 /* Special display processing for tickets. Display the hyperlink
1063 ** as crossed out if the ticket is closed.
1064 */
1065 if( isClosed ){
1066 if( g.perm.History ){
1067 blob_appendf(p->pOut,
1068 "<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
1069 g.zTop, zTarget
1070 );
1071 zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
1072 }else{
1073 blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
1074 zTerm = "]</span>";
1075 }
1076 }else{
1077 if( g.perm.History ){
1078 blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
1079 g.zTop, zTarget
1080 );
1081 zTerm = "]</a>";
1082 }else{
@@ -1085,11 +1085,11 @@
1085 }
1086 }
1087 }else if( !in_this_repo(zTarget) ){
1088 blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
1089 zTerm = "]</span>";
1090 }else if( g.perm.History ){
1091 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
1092 zTerm = "]</a>";
1093 }
1094 }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
1095 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1096
+16 -16
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129129
blob_extract(pXfer->pIn, n, &content);
130130
if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131131
/* Ignore files that have been shunned */
132132
return;
133133
}
134
- if( isPriv && !g.okPrivate ){
134
+ if( isPriv && !g.perm.Private ){
135135
/* Do not accept private files if not authorized */
136136
return;
137137
}
138138
if( cloneFlag ){
139139
if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227227
|| (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228228
){
229229
blob_appendf(&pXfer->err, "malformed cfile line");
230230
return;
231231
}
232
- if( isPriv && !g.okPrivate ){
232
+ if( isPriv && !g.perm.Private ){
233233
/* Do not accept private files if not authorized */
234234
return;
235235
}
236236
blob_zero(&content);
237237
blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908908
&& blob_is_uuid(&xfer.aToken[1])
909909
){
910910
if( isPush ){
911911
if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912912
rid_from_uuid(&xfer.aToken[1], 1, 0);
913
- }else if( g.okPrivate ){
913
+ }else if( g.perm.Private ){
914914
rid_from_uuid(&xfer.aToken[1], 1, 1);
915915
}else{
916916
server_private_xfer_not_authorized();
917917
}
918918
}
@@ -941,19 +941,19 @@
941941
nErr++;
942942
break;
943943
}
944944
login_check_credentials();
945945
if( blob_eq(&xfer.aToken[0], "pull") ){
946
- if( !g.okRead ){
946
+ if( !g.perm.Read ){
947947
cgi_reset_content();
948948
@ error not\sauthorized\sto\sread
949949
nErr++;
950950
break;
951951
}
952952
isPull = 1;
953953
}else{
954
- if( !g.okWrite ){
954
+ if( !g.perm.Write ){
955955
if( !isPull ){
956956
cgi_reset_content();
957957
@ error not\sauthorized\sto\swrite
958958
nErr++;
959959
}else{
@@ -970,11 +970,11 @@
970970
** The client knows nothing. Tell all.
971971
*/
972972
if( blob_eq(&xfer.aToken[0], "clone") ){
973973
int iVers;
974974
login_check_credentials();
975
- if( !g.okClone ){
975
+ if( !g.perm.Clone ){
976976
cgi_reset_content();
977977
@ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978978
@ error not\sauthorized\sto\sclone
979979
nErr++;
980980
break;
@@ -1014,11 +1014,11 @@
10141014
*/
10151015
if( blob_eq(&xfer.aToken[0], "login")
10161016
&& xfer.nToken==4
10171017
){
10181018
if( disableLogin ){
1019
- g.okRead = g.okWrite = g.okPrivate = g.okAdmin = 1;
1019
+ g.perm.Read = g.perm.Write = g.perm.Private = g.perm.Admin = 1;
10201020
}else{
10211021
if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
10221022
|| check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
10231023
){
10241024
cgi_reset_content();
@@ -1034,17 +1034,17 @@
10341034
** Request a configuration value
10351035
*/
10361036
if( blob_eq(&xfer.aToken[0], "reqconfig")
10371037
&& xfer.nToken==2
10381038
){
1039
- if( g.okRead ){
1039
+ if( g.perm.Read ){
10401040
char *zName = blob_str(&xfer.aToken[1]);
10411041
if( zName[0]=='/' ){
10421042
/* New style configuration transfer */
10431043
int groupMask = configure_name_to_mask(&zName[1], 0);
1044
- if( !g.okAdmin ) groupMask &= ~CONFIGSET_USER;
1045
- if( !g.okRdAddr ) groupMask &= ~CONFIGSET_ADDR;
1044
+ if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER;
1045
+ if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR;
10461046
configure_send_group(xfer.pOut, groupMask, 0);
10471047
}else if( configure_is_exportable(zName) ){
10481048
/* Old style configuration transfer */
10491049
send_legacy_config_card(&xfer, zName);
10501050
}
@@ -1060,11 +1060,11 @@
10601060
&& blob_is_int(&xfer.aToken[2], &size) ){
10611061
const char *zName = blob_str(&xfer.aToken[1]);
10621062
Blob content;
10631063
blob_zero(&content);
10641064
blob_extract(xfer.pIn, size, &content);
1065
- if( !g.okAdmin ){
1065
+ if( !g.perm.Admin ){
10661066
cgi_reset_content();
10671067
@ error not\sauthorized\sto\spush\sconfiguration
10681068
nErr++;
10691069
break;
10701070
}
@@ -1105,11 +1105,11 @@
11051105
**
11061106
** This card indicates that the next "file" or "cfile" will contain
11071107
** private content.
11081108
*/
11091109
if( blob_eq(&xfer.aToken[0], "private") ){
1110
- if( !g.okPrivate ){
1110
+ if( !g.perm.Private ){
11111111
server_private_xfer_not_authorized();
11121112
}else{
11131113
xfer.nextIsPrivate = 1;
11141114
}
11151115
}else
@@ -1128,11 +1128,11 @@
11281128
** it is not automatic with "a" or "s") then this pragma causes
11291129
** private information to be pulled in addition to public records.
11301130
*/
11311131
if( blob_eq(&xfer.aToken[1], "send-private") ){
11321132
login_check_credentials();
1133
- if( !g.okPrivate ){
1133
+ if( !g.perm.Private ){
11341134
server_private_xfer_not_authorized();
11351135
}else{
11361136
xfer.syncPrivate = 1;
11371137
}
11381138
}
@@ -1266,11 +1266,11 @@
12661266
memset(&xfer, 0, sizeof(xfer));
12671267
xfer.pIn = &recv;
12681268
xfer.pOut = &send;
12691269
xfer.mxSend = db_get_int("max-upload", 250000);
12701270
if( privateFlag ){
1271
- g.okPrivate = 1;
1271
+ g.perm.Private = 1;
12721272
xfer.syncPrivate = 1;
12731273
}
12741274
12751275
assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
12761276
db_begin_transaction();
@@ -1508,11 +1508,11 @@
15081508
int rid;
15091509
int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
15101510
rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
15111511
if( rid>0 ){
15121512
if( !isPriv ) content_make_public(rid);
1513
- }else if( isPriv && !g.okPrivate ){
1513
+ }else if( isPriv && !g.perm.Private ){
15141514
/* ignore private files */
15151515
}else if( pullFlag || cloneFlag ){
15161516
rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
15171517
if( rid ) newPhantom = 1;
15181518
}
@@ -1553,11 +1553,11 @@
15531553
&& blob_is_int(&xfer.aToken[2], &size) ){
15541554
const char *zName = blob_str(&xfer.aToken[1]);
15551555
Blob content;
15561556
blob_zero(&content);
15571557
blob_extract(xfer.pIn, size, &content);
1558
- g.okAdmin = g.okRdAddr = 1;
1558
+ g.perm.Admin = g.perm.RdAddr = 1;
15591559
configure_receive(zName, &content, origConfigRcvMask);
15601560
nCardSent++;
15611561
blob_reset(&content);
15621562
blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
15631563
}else
15641564
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129 blob_extract(pXfer->pIn, n, &content);
130 if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131 /* Ignore files that have been shunned */
132 return;
133 }
134 if( isPriv && !g.okPrivate ){
135 /* Do not accept private files if not authorized */
136 return;
137 }
138 if( cloneFlag ){
139 if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227 || (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228 ){
229 blob_appendf(&pXfer->err, "malformed cfile line");
230 return;
231 }
232 if( isPriv && !g.okPrivate ){
233 /* Do not accept private files if not authorized */
234 return;
235 }
236 blob_zero(&content);
237 blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908 && blob_is_uuid(&xfer.aToken[1])
909 ){
910 if( isPush ){
911 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912 rid_from_uuid(&xfer.aToken[1], 1, 0);
913 }else if( g.okPrivate ){
914 rid_from_uuid(&xfer.aToken[1], 1, 1);
915 }else{
916 server_private_xfer_not_authorized();
917 }
918 }
@@ -941,19 +941,19 @@
941 nErr++;
942 break;
943 }
944 login_check_credentials();
945 if( blob_eq(&xfer.aToken[0], "pull") ){
946 if( !g.okRead ){
947 cgi_reset_content();
948 @ error not\sauthorized\sto\sread
949 nErr++;
950 break;
951 }
952 isPull = 1;
953 }else{
954 if( !g.okWrite ){
955 if( !isPull ){
956 cgi_reset_content();
957 @ error not\sauthorized\sto\swrite
958 nErr++;
959 }else{
@@ -970,11 +970,11 @@
970 ** The client knows nothing. Tell all.
971 */
972 if( blob_eq(&xfer.aToken[0], "clone") ){
973 int iVers;
974 login_check_credentials();
975 if( !g.okClone ){
976 cgi_reset_content();
977 @ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978 @ error not\sauthorized\sto\sclone
979 nErr++;
980 break;
@@ -1014,11 +1014,11 @@
1014 */
1015 if( blob_eq(&xfer.aToken[0], "login")
1016 && xfer.nToken==4
1017 ){
1018 if( disableLogin ){
1019 g.okRead = g.okWrite = g.okPrivate = g.okAdmin = 1;
1020 }else{
1021 if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
1022 || check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
1023 ){
1024 cgi_reset_content();
@@ -1034,17 +1034,17 @@
1034 ** Request a configuration value
1035 */
1036 if( blob_eq(&xfer.aToken[0], "reqconfig")
1037 && xfer.nToken==2
1038 ){
1039 if( g.okRead ){
1040 char *zName = blob_str(&xfer.aToken[1]);
1041 if( zName[0]=='/' ){
1042 /* New style configuration transfer */
1043 int groupMask = configure_name_to_mask(&zName[1], 0);
1044 if( !g.okAdmin ) groupMask &= ~CONFIGSET_USER;
1045 if( !g.okRdAddr ) groupMask &= ~CONFIGSET_ADDR;
1046 configure_send_group(xfer.pOut, groupMask, 0);
1047 }else if( configure_is_exportable(zName) ){
1048 /* Old style configuration transfer */
1049 send_legacy_config_card(&xfer, zName);
1050 }
@@ -1060,11 +1060,11 @@
1060 && blob_is_int(&xfer.aToken[2], &size) ){
1061 const char *zName = blob_str(&xfer.aToken[1]);
1062 Blob content;
1063 blob_zero(&content);
1064 blob_extract(xfer.pIn, size, &content);
1065 if( !g.okAdmin ){
1066 cgi_reset_content();
1067 @ error not\sauthorized\sto\spush\sconfiguration
1068 nErr++;
1069 break;
1070 }
@@ -1105,11 +1105,11 @@
1105 **
1106 ** This card indicates that the next "file" or "cfile" will contain
1107 ** private content.
1108 */
1109 if( blob_eq(&xfer.aToken[0], "private") ){
1110 if( !g.okPrivate ){
1111 server_private_xfer_not_authorized();
1112 }else{
1113 xfer.nextIsPrivate = 1;
1114 }
1115 }else
@@ -1128,11 +1128,11 @@
1128 ** it is not automatic with "a" or "s") then this pragma causes
1129 ** private information to be pulled in addition to public records.
1130 */
1131 if( blob_eq(&xfer.aToken[1], "send-private") ){
1132 login_check_credentials();
1133 if( !g.okPrivate ){
1134 server_private_xfer_not_authorized();
1135 }else{
1136 xfer.syncPrivate = 1;
1137 }
1138 }
@@ -1266,11 +1266,11 @@
1266 memset(&xfer, 0, sizeof(xfer));
1267 xfer.pIn = &recv;
1268 xfer.pOut = &send;
1269 xfer.mxSend = db_get_int("max-upload", 250000);
1270 if( privateFlag ){
1271 g.okPrivate = 1;
1272 xfer.syncPrivate = 1;
1273 }
1274
1275 assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
1276 db_begin_transaction();
@@ -1508,11 +1508,11 @@
1508 int rid;
1509 int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
1510 rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
1511 if( rid>0 ){
1512 if( !isPriv ) content_make_public(rid);
1513 }else if( isPriv && !g.okPrivate ){
1514 /* ignore private files */
1515 }else if( pullFlag || cloneFlag ){
1516 rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
1517 if( rid ) newPhantom = 1;
1518 }
@@ -1553,11 +1553,11 @@
1553 && blob_is_int(&xfer.aToken[2], &size) ){
1554 const char *zName = blob_str(&xfer.aToken[1]);
1555 Blob content;
1556 blob_zero(&content);
1557 blob_extract(xfer.pIn, size, &content);
1558 g.okAdmin = g.okRdAddr = 1;
1559 configure_receive(zName, &content, origConfigRcvMask);
1560 nCardSent++;
1561 blob_reset(&content);
1562 blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
1563 }else
1564
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129 blob_extract(pXfer->pIn, n, &content);
130 if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131 /* Ignore files that have been shunned */
132 return;
133 }
134 if( isPriv && !g.perm.Private ){
135 /* Do not accept private files if not authorized */
136 return;
137 }
138 if( cloneFlag ){
139 if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227 || (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228 ){
229 blob_appendf(&pXfer->err, "malformed cfile line");
230 return;
231 }
232 if( isPriv && !g.perm.Private ){
233 /* Do not accept private files if not authorized */
234 return;
235 }
236 blob_zero(&content);
237 blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908 && blob_is_uuid(&xfer.aToken[1])
909 ){
910 if( isPush ){
911 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912 rid_from_uuid(&xfer.aToken[1], 1, 0);
913 }else if( g.perm.Private ){
914 rid_from_uuid(&xfer.aToken[1], 1, 1);
915 }else{
916 server_private_xfer_not_authorized();
917 }
918 }
@@ -941,19 +941,19 @@
941 nErr++;
942 break;
943 }
944 login_check_credentials();
945 if( blob_eq(&xfer.aToken[0], "pull") ){
946 if( !g.perm.Read ){
947 cgi_reset_content();
948 @ error not\sauthorized\sto\sread
949 nErr++;
950 break;
951 }
952 isPull = 1;
953 }else{
954 if( !g.perm.Write ){
955 if( !isPull ){
956 cgi_reset_content();
957 @ error not\sauthorized\sto\swrite
958 nErr++;
959 }else{
@@ -970,11 +970,11 @@
970 ** The client knows nothing. Tell all.
971 */
972 if( blob_eq(&xfer.aToken[0], "clone") ){
973 int iVers;
974 login_check_credentials();
975 if( !g.perm.Clone ){
976 cgi_reset_content();
977 @ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978 @ error not\sauthorized\sto\sclone
979 nErr++;
980 break;
@@ -1014,11 +1014,11 @@
1014 */
1015 if( blob_eq(&xfer.aToken[0], "login")
1016 && xfer.nToken==4
1017 ){
1018 if( disableLogin ){
1019 g.perm.Read = g.perm.Write = g.perm.Private = g.perm.Admin = 1;
1020 }else{
1021 if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
1022 || check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
1023 ){
1024 cgi_reset_content();
@@ -1034,17 +1034,17 @@
1034 ** Request a configuration value
1035 */
1036 if( blob_eq(&xfer.aToken[0], "reqconfig")
1037 && xfer.nToken==2
1038 ){
1039 if( g.perm.Read ){
1040 char *zName = blob_str(&xfer.aToken[1]);
1041 if( zName[0]=='/' ){
1042 /* New style configuration transfer */
1043 int groupMask = configure_name_to_mask(&zName[1], 0);
1044 if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER;
1045 if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR;
1046 configure_send_group(xfer.pOut, groupMask, 0);
1047 }else if( configure_is_exportable(zName) ){
1048 /* Old style configuration transfer */
1049 send_legacy_config_card(&xfer, zName);
1050 }
@@ -1060,11 +1060,11 @@
1060 && blob_is_int(&xfer.aToken[2], &size) ){
1061 const char *zName = blob_str(&xfer.aToken[1]);
1062 Blob content;
1063 blob_zero(&content);
1064 blob_extract(xfer.pIn, size, &content);
1065 if( !g.perm.Admin ){
1066 cgi_reset_content();
1067 @ error not\sauthorized\sto\spush\sconfiguration
1068 nErr++;
1069 break;
1070 }
@@ -1105,11 +1105,11 @@
1105 **
1106 ** This card indicates that the next "file" or "cfile" will contain
1107 ** private content.
1108 */
1109 if( blob_eq(&xfer.aToken[0], "private") ){
1110 if( !g.perm.Private ){
1111 server_private_xfer_not_authorized();
1112 }else{
1113 xfer.nextIsPrivate = 1;
1114 }
1115 }else
@@ -1128,11 +1128,11 @@
1128 ** it is not automatic with "a" or "s") then this pragma causes
1129 ** private information to be pulled in addition to public records.
1130 */
1131 if( blob_eq(&xfer.aToken[1], "send-private") ){
1132 login_check_credentials();
1133 if( !g.perm.Private ){
1134 server_private_xfer_not_authorized();
1135 }else{
1136 xfer.syncPrivate = 1;
1137 }
1138 }
@@ -1266,11 +1266,11 @@
1266 memset(&xfer, 0, sizeof(xfer));
1267 xfer.pIn = &recv;
1268 xfer.pOut = &send;
1269 xfer.mxSend = db_get_int("max-upload", 250000);
1270 if( privateFlag ){
1271 g.perm.Private = 1;
1272 xfer.syncPrivate = 1;
1273 }
1274
1275 assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
1276 db_begin_transaction();
@@ -1508,11 +1508,11 @@
1508 int rid;
1509 int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
1510 rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
1511 if( rid>0 ){
1512 if( !isPriv ) content_make_public(rid);
1513 }else if( isPriv && !g.perm.Private ){
1514 /* ignore private files */
1515 }else if( pullFlag || cloneFlag ){
1516 rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
1517 if( rid ) newPhantom = 1;
1518 }
@@ -1553,11 +1553,11 @@
1553 && blob_is_int(&xfer.aToken[2], &size) ){
1554 const char *zName = blob_str(&xfer.aToken[1]);
1555 Blob content;
1556 blob_zero(&content);
1557 blob_extract(xfer.pIn, size, &content);
1558 g.perm.Admin = g.perm.RdAddr = 1;
1559 configure_receive(zName, &content, origConfigRcvMask);
1560 nCardSent++;
1561 blob_reset(&content);
1562 blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
1563 }else
1564
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426426
char *zName, *zRid;
427427
int nName, nRid;
428428
Blob zip;
429429
430430
login_check_credentials();
431
- if( !g.okZip ){ login_needed(); return; }
431
+ if( !g.perm.Zip ){ login_needed(); return; }
432432
zName = mprintf("%s", PD("name",""));
433433
nName = strlen(zName);
434434
zRid = mprintf("%s", PD("uuid",""));
435435
nRid = strlen(zRid);
436436
for(nName=strlen(zName)-1; nName>5; nName--){
437437
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426 char *zName, *zRid;
427 int nName, nRid;
428 Blob zip;
429
430 login_check_credentials();
431 if( !g.okZip ){ login_needed(); return; }
432 zName = mprintf("%s", PD("name",""));
433 nName = strlen(zName);
434 zRid = mprintf("%s", PD("uuid",""));
435 nRid = strlen(zRid);
436 for(nName=strlen(zName)-1; nName>5; nName--){
437
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426 char *zName, *zRid;
427 int nName, nRid;
428 Blob zip;
429
430 login_check_credentials();
431 if( !g.perm.Zip ){ login_needed(); return; }
432 zName = mprintf("%s", PD("name",""));
433 nName = strlen(zName);
434 zRid = mprintf("%s", PD("uuid",""));
435 nRid = strlen(zRid);
436 for(nName=strlen(zName)-1; nName>5; nName--){
437

Keyboard Shortcuts

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