Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge in trunk. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | revert-dir |
Files: | files | file ages | folders |
SHA3-256: |
0ad3e06bd2eff6b3cb6628e9e3cad597 |
User & Date: | ashepilko 2020-05-19 18:31:09.313 |
Context
2020-06-04
| ||
20:51 | revert: Allow reverting of current changes for the whole directory tree. ... (check-in: a8bb0869 user: ashepilko tags: trunk) | |
2020-05-19
| ||
18:31 | Merge in trunk. ... (Closed-Leaf check-in: 0ad3e06b user: ashepilko tags: revert-dir) | |
16:51 | Update the built-in SQLite to the third beta for 3.32.0. ... (check-in: a8098efe user: drh tags: trunk) | |
2020-05-11
| ||
04:17 | Merge in trunk. ... (check-in: 09239396 user: ashepilko tags: revert-dir) | |
Changes
Changes to skins/default/header.txt.
︙ | ︙ | |||
15 16 17 18 19 20 21 | upvar home home if {[string range $url 0 [string length $current]] eq "/$current"} { html "<a href='$home$url' class='active $cls'>$name</a>\n" } else { html "<a href='$home$url' class='$cls'>$name</a>\n" } } | | > | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | upvar home home if {[string range $url 0 [string length $current]] eq "/$current"} { html "<a href='$home$url' class='active $cls'>$name</a>\n" } else { html "<a href='$home$url' class='$cls'>$name</a>\n" } } html "<a id='hbbtn' href='$home/sitemap' aria-label='Site Map'>☰</a>" menulink $index_page Home {} if {[anycap jor]} { menulink /timeline Timeline {} } if {[hascap oh]} { if {![info exists current_checkin]} {set current_checkin tip} menulink /dir?ci=$current_checkin Files desktoponly } if {[hascap o]} { menulink /brlist Branches desktoponly menulink /taglist Tags wideonly } if {[anycap 23456] || [anoncap 2] || [anoncap 3]} { menulink /forum Forum wideonly |
︙ | ︙ |
Changes to src/allrepo.c.
︙ | ︙ | |||
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | zCmd = "fts-config -R"; collect_argv(&extra, 3); }else if( strncmp(zCmd, "sync", n)==0 ){ zCmd = "sync -autourl -R"; collect_argument(&extra, "verbose","v"); collect_argument(&extra, "unversioned","u"); }else if( strncmp(zCmd, "test-integrity", n)==0 ){ collect_argument(&extra, "parse", 0); zCmd = "test-integrity"; }else if( strncmp(zCmd, "test-orphans", n)==0 ){ zCmd = "test-orphans -R"; }else if( strncmp(zCmd, "test-missing", n)==0 ){ zCmd = "test-missing -q -R"; collect_argument(&extra, "notshunned",0); }else if( strncmp(zCmd, "changes", n)==0 ){ | > > | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | zCmd = "fts-config -R"; collect_argv(&extra, 3); }else if( strncmp(zCmd, "sync", n)==0 ){ zCmd = "sync -autourl -R"; collect_argument(&extra, "verbose","v"); collect_argument(&extra, "unversioned","u"); }else if( strncmp(zCmd, "test-integrity", n)==0 ){ collect_argument(&extra, "db-only", "d"); collect_argument(&extra, "parse", 0); collect_argument(&extra, "quick", "q"); zCmd = "test-integrity"; }else if( strncmp(zCmd, "test-orphans", n)==0 ){ zCmd = "test-orphans -R"; }else if( strncmp(zCmd, "test-missing", n)==0 ){ zCmd = "test-missing -q -R"; collect_argument(&extra, "notshunned",0); }else if( strncmp(zCmd, "changes", n)==0 ){ |
︙ | ︙ |
Changes to src/branch.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ******************************************************************************* ** ** This file contains code used to create new branches within a repository. */ #include "config.h" #include "branch.h" #include <assert.h> /* ** If RID refers to a check-in, return the name of the branch for that ** check-in. ** ** Space to hold the returned value is obtained from fossil_malloc() ** and should be freed by the caller. | > > > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ******************************************************************************* ** ** This file contains code used to create new branches within a repository. */ #include "config.h" #include "branch.h" #include <assert.h> /* ** Return true if zBr is the branch name associated with check-in with ** blob.uuid value of zUuid */ int branch_includes_uuid(const char *zBr, const char *zUuid){ return db_exists( "SELECT 1 FROM tagxref, blob" " WHERE blob.uuid=%Q AND tagxref.rid=blob.rid" " AND tagxref.value=%Q AND tagxref.tagtype>0" " AND tagxref.tagid=%d", zUuid, zBr, TAG_BRANCH ); } /* ** If RID refers to a check-in, return the name of the branch for that ** check-in. ** ** Space to hold the returned value is obtained from fossil_malloc() ** and should be freed by the caller. |
︙ | ︙ |
Changes to src/browse.c.
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | sqlite3_result_text(context, (char*)&z[n], len-n, SQLITE_TRANSIENT); }else{ zOut = sqlite3_mprintf("/%.*s", i-n, &z[n]); sqlite3_result_text(context, zOut, i-n+1, sqlite3_free); } } /* ** Given a pathname which is a relative path from the root of ** the repository to a file or directory, compute a string which ** is an HTML rendering of that path with hyperlinks on each ** directory component of the path where the hyperlink redirects ** to the "dir" page for the directory. ** ** There is no hyperlink on the file element of the path. ** ** The computed string is appended to the pOut blob. pOut should ** have already been initialized. */ void hyperlinked_path( const char *zPath, /* Path to render */ Blob *pOut, /* Write into this blob */ const char *zCI, /* check-in name, or NULL */ const char *zURI, /* "dir" or "tree" */ | > > > > > > > > | > | > > > > > > > > > | | | | | | | | < < < | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | sqlite3_result_text(context, (char*)&z[n], len-n, SQLITE_TRANSIENT); }else{ zOut = sqlite3_mprintf("/%.*s", i-n, &z[n]); sqlite3_result_text(context, zOut, i-n+1, sqlite3_free); } } /* ** Flag arguments for hyperlinked_path() */ #if INTERFACE # define LINKPATH_FINFO 0x0001 /* Link final term to /finfo */ # define LINKPATH_FILE 0x0002 /* Link final term to /file */ #endif /* ** Given a pathname which is a relative path from the root of ** the repository to a file or directory, compute a string which ** is an HTML rendering of that path with hyperlinks on each ** directory component of the path where the hyperlink redirects ** to the "dir" page for the directory. ** ** There is no hyperlink on the file element of the path. ** ** The computed string is appended to the pOut blob. pOut should ** have already been initialized. */ void hyperlinked_path( const char *zPath, /* Path to render */ Blob *pOut, /* Write into this blob */ const char *zCI, /* check-in name, or NULL */ const char *zURI, /* "dir" or "tree" */ const char *zREx, /* Extra query parameters */ unsigned int mFlags /* Extra flags */ ){ int i, j; char *zSep = ""; for(i=0; zPath[i]; i=j){ for(j=i; zPath[j] && zPath[j]!='/'; j++){} if( zPath[j]==0 ){ if( mFlags & LINKPATH_FILE ){ zURI = "file"; }else if( mFlags & LINKPATH_FINFO ){ zURI = "finfo"; }else{ blob_appendf(pOut, "/%h", zPath+i); break; } } if( zCI ){ char *zLink = href("%R/%s?name=%#T%s&ci=%T", zURI, j, zPath, zREx,zCI); blob_appendf(pOut, "%s%z%#h</a>", zSep, zLink, j-i, &zPath[i]); }else{ char *zLink = href("%R/%s?name=%#T%s", zURI, j, zPath, zREx); blob_appendf(pOut, "%s%z%#h</a>", zSep, zLink, j-i, &zPath[i]); } zSep = "/"; while( zPath[j]=='/' ){ j++; } } } |
︙ | ︙ | |||
125 126 127 128 129 130 131 | int nD = zD ? strlen(zD)+1 : 0; int mxLen; char *zPrefix; Stmt q; const char *zCI = P("ci"); int rid = 0; char *zUuid = 0; | < > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | int nD = zD ? strlen(zD)+1 : 0; int mxLen; char *zPrefix; Stmt q; const char *zCI = P("ci"); int rid = 0; char *zUuid = 0; Manifest *pM = 0; const char *zSubdirLink; int linkTrunk = 1; int linkTip = 1; HQuery sURI; int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */ int isBranchCI = 0; /* True if ci= refers to a branch name */ char *zHeader = 0; if( zCI && strlen(zCI)==0 ){ zCI = 0; } if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; } login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
︙ | ︙ | |||
155 156 157 158 159 160 161 162 163 164 165 166 167 | pM = manifest_get_by_name(zCI, &rid); if( pM ){ int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); linkTrunk = trunkRid && rid != trunkRid; linkTip = rid != symbolic_name_to_rid("tip", "ci"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); }else{ zCI = 0; } } assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); | > > > | | | | > > > > | > < > | | > > | > > > > > > > > > > > > > > > > > < < < | | < < < < < < < < < < < < < < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | pM = manifest_get_by_name(zCI, &rid); if( pM ){ int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); linkTrunk = trunkRid && rid != trunkRid; linkTip = rid != symbolic_name_to_rid("tip", "ci"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); isBranchCI = branch_includes_uuid(zCI, zUuid); Th_Store("current_checkin", zCI); }else{ zCI = 0; } } assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); if( zD==0 ){ if( zCI ){ zHeader = mprintf("Top-level Files of %s", zCI); }else{ zHeader = mprintf("All Top-level Files"); } }else{ if( zCI ){ zHeader = mprintf("Files in %s/ of %s", zD, zCI); }else{ zHeader = mprintf("All File in %s/", zD); } } style_header("%s", zHeader); fossil_free(zHeader); style_adunit_config(ADUNIT_RIGHT_OK); sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, pathelementFunc, 0, 0); url_initialize(&sURI, "dir"); cgi_query_parameters_to_url(&sURI); /* Compute the title of the page */ if( zD ){ Blob dirname; blob_init(&dirname, 0, 0); hyperlinked_path(zD, &dirname, zCI, "dir", "", 0); @ <h2>Files in directory %s(blob_str(&dirname)) \ blob_reset(&dirname); zPrefix = mprintf("%s/", zD); style_submenu_element("Top-Level", "%s", url_render(&sURI, "name", 0, 0, 0)); }else{ @ <h2>Files in the top-level directory \ zPrefix = ""; } if( zCI ){ if( fossil_strcmp(zCI,"tip")==0 ){ @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a></h2> }else if( isBranchCI ){ @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \ @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2> }else { @ of check-in %z(href("%R/info?name=%T",zCI))%h(zCI)</a></h2> } zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix); if( nD==0 ){ style_submenu_element("File Ages", "%R/fileage?name=%T", zCI); } }else{ @ in any check-in</h2> zSubdirLink = mprintf("%R/dir?name=%T", zPrefix); } if( linkTrunk ){ style_submenu_element("Trunk", "%s", url_render(&sURI, "ci", "trunk", 0, 0)); } if( linkTip ){ style_submenu_element("Tip", "%s", url_render(&sURI, "ci", "tip", 0, 0)); } if( zD ){ style_submenu_element("History","%R/timeline?chng=%T/*", zD); } style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0)); style_submenu_element("Tree-View", "%s", url_render(&sURI, "type", "tree", 0, 0)); /* Compute the temporary table "localfiles" containing the names ** of all files and subdirectories in the zD[] directory. |
︙ | ︙ | |||
294 295 296 297 298 299 300 | zFN = db_column_text(&q, 0); if( zFN[0]=='/' ){ zFN++; @ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li> }else{ const char *zLink; if( zCI ){ | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | zFN = db_column_text(&q, 0); if( zFN[0]=='/' ){ zFN++; @ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li> }else{ const char *zLink; if( zCI ){ zLink = href("%R/file?name=%T%T&ci=%T",zPrefix,zFN,zCI); }else{ zLink = href("%R/finfo?name=%T%T",zPrefix,zFN); } @ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li> } } db_finalize(&q); |
︙ | ︙ | |||
624 625 626 627 628 629 630 631 632 633 634 635 636 637 | FileTree sTree; /* The complete tree of files */ HQuery sURI; /* Hyperlink */ int startExpanded; /* True to start out with the tree expanded */ int showDirOnly; /* Show directories only. Omit files */ int nDir = 0; /* Number of directories. Used for ID attributes */ char *zProjectName = db_get("project-name", 0); int isSymbolicCI = 0; /* ci= is a symbolic name, not a hash prefix */ char *zHeader = 0; if( zCI && strlen(zCI)==0 ){ zCI = 0; } if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; } memset(&sTree, 0, sizeof(sTree)); login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } | > | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | FileTree sTree; /* The complete tree of files */ HQuery sURI; /* Hyperlink */ int startExpanded; /* True to start out with the tree expanded */ int showDirOnly; /* Show directories only. Omit files */ int nDir = 0; /* Number of directories. Used for ID attributes */ char *zProjectName = db_get("project-name", 0); int isSymbolicCI = 0; /* ci= is a symbolic name, not a hash prefix */ int isBranchCI = 0; /* ci= refers to a branch name */ char *zHeader = 0; if( zCI && strlen(zCI)==0 ){ zCI = 0; } if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; } memset(&sTree, 0, sizeof(sTree)); login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
︙ | ︙ | |||
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | linkTrunk = trunkRid && rid != trunkRid; linkTip = rid != symbolic_name_to_rid("tip", "ci"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); zNow = db_text("", "SELECT datetime(mtime,toLocal())" " FROM event WHERE objid=%d", rid); isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI)) != 0); }else{ zCI = 0; } } if( zCI==0 ){ rNow = db_double(0.0, "SELECT max(mtime) FROM event"); zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); } assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); | > > > | | < | | < > > | > | > | < | | < | | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | linkTrunk = trunkRid && rid != trunkRid; linkTip = rid != symbolic_name_to_rid("tip", "ci"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); zNow = db_text("", "SELECT datetime(mtime,toLocal())" " FROM event WHERE objid=%d", rid); isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI)) != 0); isBranchCI = branch_includes_uuid(zCI, zUuid); Th_Store("current_checkin", zCI); }else{ zCI = 0; } } if( zCI==0 ){ rNow = db_double(0.0, "SELECT max(mtime) FROM event"); zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); } assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); if( zD==0 ){ if( zCI ){ zHeader = mprintf("Top-level Files of %s", zCI); }else{ zHeader = mprintf("All Top-level Files"); } }else{ if( zCI ){ zHeader = mprintf("Files in %s/ of %s", zD, zCI); }else{ zHeader = mprintf("All File in %s/", zD); } } style_header("%s", zHeader); fossil_free(zHeader); /* Compute the title of the page */ blob_zero(&dirname); if( zD ){ blob_append(&dirname, "within directory ", -1); hyperlinked_path(zD, &dirname, zCI, "tree", zREx, 0); if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE); style_submenu_element("Top-Level", "%s", url_render(&sURI, "name", 0, 0, 0)); }else if( zRE ){ blob_appendf(&dirname, "matching \"%s\"", zRE); } style_submenu_binary("mtime","Sort By Time","Sort By Filename", 0); if( zCI ){ style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0)); if( nD==0 && !showDirOnly ){ style_submenu_element("File Ages", "%R/fileage?name=%T", zCI); } } if( linkTrunk ){ style_submenu_element("Trunk", "%s", url_render(&sURI, "ci", "trunk", 0, 0)); } if( linkTip ){ |
︙ | ︙ | |||
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | } if( pRE && re_match(pRE, (const u8*)zName, -1)==0 ) continue; tree_add_node(&sTree, zName, zUuid, mtime); nFile++; } db_finalize(&q); } if( showDirOnly ){ for(nFile=0, p=sTree.pFirst; p; p=p->pNext){ if( p->pChild!=0 && p->nFullName>nD ) nFile++; } zObjType = "Folders"; }else{ zObjType = "Files"; } | > | > > > > > > | | | < | > > < | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | } if( pRE && re_match(pRE, (const u8*)zName, -1)==0 ) continue; tree_add_node(&sTree, zName, zUuid, mtime); nFile++; } db_finalize(&q); } style_submenu_checkbox("nofiles", "Folders Only", 0, 0); if( showDirOnly ){ for(nFile=0, p=sTree.pFirst; p; p=p->pNext){ if( p->pChild!=0 && p->nFullName>nD ) nFile++; } zObjType = "Folders"; }else{ zObjType = "Files"; } if( zCI && strcmp(zCI,"tip")==0 ){ @ <h2>%s(zObjType) in the %z(href("%R/info?name=tip"))latest check-in</a> }else if( isBranchCI ){ @ <h2>%s(zObjType) in the %z(href("%R/info?name=%T",zCI))latest check-in\ @ </a> for branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a> if( blob_size(&dirname) ){ @ and %s(blob_str(&dirname))</h2> } }else if( zCI ){ @ <h2>%s(zObjType) for check-in \ @ %z(href("%R/info?name=%T",zCI))%h(zCI)</a></h2> if( blob_size(&dirname) ){ @ and %s(blob_str(&dirname))</h2> } }else{ int n = db_int(0, "SELECT count(*) FROM plink"); @ <h2>%s(zObjType) from all %d(n) check-ins %s(blob_str(&dirname)) } if( useMtime ){ @ sorted by modification time</h2> }else{ |
︙ | ︙ | |||
851 852 853 854 855 856 857 | @ <ul id="dir%d(nDir)" class="collapsed"> } nDir++; }else if( !showDirOnly ){ const char *zFileClass = fileext_class(p->zName); char *zLink; if( zCI ){ | | | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | @ <ul id="dir%d(nDir)" class="collapsed"> } nDir++; }else if( !showDirOnly ){ const char *zFileClass = fileext_class(p->zName); char *zLink; if( zCI ){ zLink = href("%R/file?name=%T&ci=%T",p->zFullName,zCI); }else{ zLink = href("%R/finfo?name=%T",p->zFullName); } @ <li class="%z(zFileClass)%s(zLastClass)"><div class="filetreeline"> @ %z(zLink)%h(p->zName)</a> if( p->mtime>0 ){ char *zAge = human_readable_age(rNow - p->mtime); |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | */ void fileage_page(void){ int rid; const char *zName; const char *zGlob; const char *zUuid; const char *zNow; /* Time of check-in */ int showId = PB("showid"); Stmt q1, q2; double baseTime; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } if( exclude_spiders() ) return; zName = P("name"); if( zName==0 ) zName = "tip"; rid = symbolic_name_to_rid(zName, "ci"); if( rid==0 ){ fossil_fatal("not a valid check-in: %s", zName); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid); zNow = db_text("", "SELECT datetime(mtime,toLocal()) FROM event" " WHERE objid=%d", rid); style_submenu_element("Tree-View", "%R/tree?ci=%T&mtime=1&type=tree", zName); style_header("File Ages"); zGlob = P("glob"); compute_fileage(rid,zGlob); db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);"); | > > > | > | > > > > | < | | < < | < > > | | | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | */ void fileage_page(void){ int rid; const char *zName; const char *zGlob; const char *zUuid; const char *zNow; /* Time of check-in */ int isBranchCI; /* name= is a branch name */ int showId = PB("showid"); Stmt q1, q2; double baseTime; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } if( exclude_spiders() ) return; zName = P("name"); if( zName==0 ) zName = "tip"; rid = symbolic_name_to_rid(zName, "ci"); if( rid==0 ){ fossil_fatal("not a valid check-in: %s", zName); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); isBranchCI = branch_includes_uuid(zName,zUuid); baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid); zNow = db_text("", "SELECT datetime(mtime,toLocal()) FROM event" " WHERE objid=%d", rid); style_submenu_element("Tree-View", "%R/tree?ci=%T&mtime=1&type=tree", zName); style_header("File Ages"); zGlob = P("glob"); compute_fileage(rid,zGlob); db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);"); if( fossil_strcmp(zName,"tip")==0 ){ @ <h1>Files in the %z(href("%R/info?name=tip"))latest check-in</a> }else if( isBranchCI ){ @ <h1>Files in the %z(href("%R/info?name=%T",zName))latest check-in</a> @ of branch %z(href("%R/timeline?r=%T",zName))%h(zName)</a> }else{ @ <h1>Files in check-in %z(href("%R/info?name=%T",zName))%h(zName)</a> } if( zGlob && zGlob[0] ){ @ that match "%h(zGlob)" } @ ordered by age</h1> @ @ <p>File ages are expressed relative to the check-in time of @ %z(href("%R/timeline?c=%t",zNow))%s(zNow)</a>.</p> @ @ <div class='fileage'><table> @ <tr><th>Age</th><th>Files</th><th>Check-in</th></tr> db_prepare(&q1, "SELECT event.mtime, event.objid, blob.uuid,\n" " coalesce(event.ecomment,event.comment),\n" " coalesce(event.euser,event.user),\n" " coalesce((SELECT value FROM tagxref\n" " WHERE tagtype>0 AND tagid=%d\n" " AND rid=event.objid),'trunk')\n" " FROM event, blob\n" " WHERE event.objid IN (SELECT mid FROM fileage)\n" " AND blob.rid=event.objid\n" " ORDER BY event.mtime DESC;", TAG_BRANCH ); db_prepare(&q2, "SELECT filename.name, fileage.fid\n" " FROM fileage, filename\n" " WHERE fileage.mid=:mid AND filename.fnid=fileage.fnid" ); while( db_step(&q1)==SQLITE_ROW ){ double age = baseTime - db_column_double(&q1, 0); int mid = db_column_int(&q1, 1); const char *zUuid = db_column_text(&q1, 2); const char *zComment = db_column_text(&q1, 3); const char *zUser = db_column_text(&q1, 4); const char *zBranch = db_column_text(&q1, 5); char *zAge = human_readable_age(age); @ <tr><td>%s(zAge)</td> @ <td> db_bind_int(&q2, ":mid", mid); while( db_step(&q2)==SQLITE_ROW ){ const char *zFile = db_column_text(&q2,0); @ %z(href("%R/file?name=%T&ci=%!S",zFile,zUuid))%h(zFile)</a> \ if( showId ){ int fid = db_column_int(&q2,1); @ (%d(fid))<br /> }else{ @ </a><br /> } } db_reset(&q2); @ </td> @ <td> @ %W(zComment) @ (check-in: %z(href("%R/info/%!S",zUuid))%S(zUuid)</a>, if( showId ){ @ id: %d(mid) } @ user: %z(href("%R/timeline?u=%t&c=%!S&nd",zUser,zUuid))%h(zUser)</a>, @ branch: \ @ %z(href("%R/timeline?r=%t&c=%!S&nd",zBranch,zUuid))%h(zBranch)</a>) @ </td></tr> |
︙ | ︙ |
Changes to src/capabilities.c.
︙ | ︙ | |||
237 238 239 240 241 242 243 | unsigned nUser; /* Number of users with this capability */ char *zAbbrev; /* Abbreviated mnemonic name */ char *zOneLiner; /* One-line summary */ } aCap[] = { { 'a', CAPCLASS_SUPER, 0, "Admin", "Create and delete users" }, { 'b', CAPCLASS_WIKI|CAPCLASS_TKT, 0, | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | unsigned nUser; /* Number of users with this capability */ char *zAbbrev; /* Abbreviated mnemonic name */ char *zOneLiner; /* One-line summary */ } aCap[] = { { 'a', CAPCLASS_SUPER, 0, "Admin", "Create and delete users" }, { 'b', CAPCLASS_WIKI|CAPCLASS_TKT, 0, "Attach", "Add attachments to wiki or tickets" }, { 'c', CAPCLASS_TKT, 0, "Append-Tkt", "Append to existing tickets" }, /* ** d unused since fork from CVSTrac; ** see https://fossil-scm.org/forum/forumpost/43c78f4bef */ { 'e', CAPCLASS_DATA, 0, |
︙ | ︙ |
Changes to src/captcha.c.
︙ | ︙ | |||
556 557 558 559 560 561 562 | } /* ** Add a "Speak the captcha" button. */ void captcha_speakit_button(unsigned int uSeed, const char *zMsg){ if( zMsg==0 ) zMsg = "Speak the text"; | | > | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | } /* ** Add a "Speak the captcha" button. */ void captcha_speakit_button(unsigned int uSeed, const char *zMsg){ if( zMsg==0 ) zMsg = "Speak the text"; @ <input aria-label="%h(zMsg)" type="button" value="%h(zMsg)" \ @ id="speakthetext"> @ <script nonce="%h(style_nonce())"> @ document.getElementById("speakthetext").onclick = function(){ @ var audio = window.fossilAudioCaptcha \ @ || new Audio("%R/captcha-audio/%u(uSeed)"); @ window.fossilAudioCaptcha = audio; @ audio.currentTime = 0; @ audio.play(); |
︙ | ︙ |
Changes to src/content.c.
︙ | ︙ | |||
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | ** COMMAND: test-integrity ** ** Verify that all content can be extracted from the BLOB table correctly. ** If the BLOB table is correct, then the repository can always be ** successfully reconstructed using "fossil rebuild". ** ** Options: ** ** --parse Parse all manifests, wikis, tickets, events, and ** so forth, reporting any errors found. */ void test_integrity(void){ Stmt q; Blob content; int n1 = 0; int n2 = 0; int nErr = 0; int total; int nCA = 0; int anCA[10]; int bParse = find_option("parse",0,0)!=0; db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); memset(anCA, 0, sizeof(anCA)); /* Make sure no public artifact is a delta from a private artifact */ db_prepare(&q, "SELECT " " rid, (SELECT uuid FROM blob WHERE rid=delta.rid)," " srcid, (SELECT uuid FROM blob WHERE rid=delta.srcid)" | > > > > > > > > > > > > > > > > > > > > | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | ** COMMAND: test-integrity ** ** Verify that all content can be extracted from the BLOB table correctly. ** If the BLOB table is correct, then the repository can always be ** successfully reconstructed using "fossil rebuild". ** ** Options: ** ** -d|--db-only Run "PRAGMA integrity_check" on the database only. ** No other validation is performed. ** ** --parse Parse all manifests, wikis, tickets, events, and ** so forth, reporting any errors found. ** ** -q|--quick Run "PRAGMA quick_check" on the database only. ** No other validation is performed. */ void test_integrity(void){ Stmt q; Blob content; int n1 = 0; int n2 = 0; int nErr = 0; int total; int nCA = 0; int anCA[10]; int bParse = find_option("parse",0,0)!=0; int bDbOnly = find_option("db-only","d",0)!=0; int bQuick = find_option("quick","q",0)!=0; db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); if( bDbOnly || bQuick ){ const char *zType = bQuick ? "quick" : "integrity"; char *zRes; zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); if( fossil_strcmp(zRes,"ok")!=0 ){ fossil_print("%s_check failed!\n", zType); exit(1); }else{ fossil_print("ok\n"); } return; } memset(anCA, 0, sizeof(anCA)); /* Make sure no public artifact is a delta from a private artifact */ db_prepare(&q, "SELECT " " rid, (SELECT uuid FROM blob WHERE rid=delta.rid)," " srcid, (SELECT uuid FROM blob WHERE rid=delta.srcid)" |
︙ | ︙ |
Changes to src/doc.c.
︙ | ︙ | |||
808 809 810 811 812 813 814 | /* ** WEBPAGE: uv ** WEBPAGE: doc ** URL: /uv/FILE ** URL: /doc/CHECKIN/FILE ** ** CHECKIN can be either tag or hash prefix or timestamp identifying a | | | > | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | /* ** WEBPAGE: uv ** WEBPAGE: doc ** URL: /uv/FILE ** URL: /doc/CHECKIN/FILE ** ** CHECKIN can be either tag or hash prefix or timestamp identifying a ** particular check-in, or the name of a branch (meaning the most recent ** check-in on that branch) or one of various magic words: ** ** "tip" means the most recent check-in ** ** "ckout" means the current check-out, if the server is run from ** within a check-out, otherwise it is the same as "tip" ** ** "latest" means use the most recent check-in for the document ** regardless of what branch it occurs on. ** ** FILE is the name of a file to delivered up as a webpage. FILE is relative ** to the root of the source tree of the repository. The FILE must ** be a part of CHECKIN, except when CHECKIN=="ckout" when FILE is read ** directly from disk and need not be a managed file. For /uv, FILE ** can also be the hash of the unversioned file. ** ** The "ckout" CHECKIN is intended for development - to provide a mechanism ** for looking at what a file will look like using the /doc webpage after ** it gets checked in. ** ** The file extension is used to decide how to render the file. ** |
︙ | ︙ | |||
929 930 931 932 933 934 935 | } }else{ goto doc_not_found; } } if( isUV ){ if( db_table_exists("repository","unversioned") ){ | > > | | | | | | | | > > | | < > | 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | } }else{ goto doc_not_found; } } if( isUV ){ if( db_table_exists("repository","unversioned") ){ rid = unversioned_content(zName, &filebody); if( rid==1 ){ Stmt q; db_prepare(&q, "SELECT hash, mtime FROM unversioned" " WHERE name=%Q", zName); if( db_step(&q)==SQLITE_ROW ){ etag_check(ETAG_HASH, db_column_text(&q,0)); etag_last_modified(db_column_int64(&q,1)); } db_finalize(&q); }else if( rid==2 ){ zName = db_text(zName, "SELECT name FROM unversioned WHERE hash=%Q", zName); g.isConst = 1; } zDfltTitle = zName; } }else if( fossil_strcmp(zCheckin,"ckout")==0 ){ /* Read from the local checkout */ char *zFullpath; db_must_be_within_tree(); zFullpath = mprintf("%s/%s", g.zLocalRoot, zName); if( file_isfile(zFullpath, RepoFILE) |
︙ | ︙ |
Changes to src/finfo.c.
︙ | ︙ | |||
436 437 438 439 440 441 442 | if( origCheckin ){ blob_appendf(&title, "Changes to file "); }else if( n>0 ){ blob_appendf(&title, "First %d ancestors of file ", n); }else{ blob_appendf(&title, "Ancestors of file "); } | | > | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | if( origCheckin ){ blob_appendf(&title, "Changes to file "); }else if( n>0 ){ blob_appendf(&title, "First %d ancestors of file ", n); }else{ blob_appendf(&title, "Ancestors of file "); } blob_appendf(&title,"%z%h</a>", href("%R/file?name=%T&ci=%!S", zFilename, zUuid), zFilename); if( fShowId ) blob_appendf(&title, " (%d)", fnid); blob_append(&title, origCheckin ? " between " : " from ", -1); blob_appendf(&title, "check-in %z%S</a>", zLink, zUuid); if( fShowId ) blob_appendf(&title, " (%d)", baseCheckin); fossil_free(zUuid); if( origCheckin ){ zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", origCheckin); zLink = href("%R/info/%!S", zUuid); blob_appendf(&title, " and check-in %z%S</a>", zLink, zUuid); fossil_free(zUuid); } }else{ blob_appendf(&title, "History for "); hyperlinked_path(zFilename, &title, 0, "tree", "", LINKPATH_FILE); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } if( uBg ){ blob_append(&title, " (color-coded by user)", -1); } @ <h2>%b(&title)</h2> blob_reset(&title); |
︙ | ︙ |
Changes to src/forum.c.
︙ | ︙ | |||
1011 1012 1013 1014 1015 1016 1017 | ){ if( zTitle ){ @ Title: <input type="input" name="title" value="%h(zTitle)" size="50" @ maxlength="125"><br> } @ %z(href("%R/markup_help"))Markup style</a>: mimetype_option_menu(zMimetype); | | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | ){ if( zTitle ){ @ Title: <input type="input" name="title" value="%h(zTitle)" size="50" @ maxlength="125"><br> } @ %z(href("%R/markup_help"))Markup style</a>: mimetype_option_menu(zMimetype); @ <br><textarea aria-label="Content:" name="content" class="wikiedit" \ @ cols="80" rows="25" wrap="virtual">%h(zContent)</textarea><br> } /* ** WEBPAGE: forumnew ** WEBPAGE: forumedit ** ** Start a new thread on the forum or reply to an existing thread. |
︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 | @ <input type="submit" name="preview" value="Preview"> if( P("preview") && !whitespace_only(zContent) ){ @ <input type="submit" name="submit" value="Submit"> }else{ @ <input type="submit" name="submit" value="Submit" disabled> } if( g.perm.Debug ){ | | > | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | @ <input type="submit" name="preview" value="Preview"> if( P("preview") && !whitespace_only(zContent) ){ @ <input type="submit" name="submit" value="Submit"> }else{ @ <input type="submit" name="submit" value="Submit" disabled> } if( g.perm.Debug ){ /* Give extra control over the post to users with the special * Debug capability, which includes Admin and Setup users */ @ <div class="debug"> @ <label><input type="checkbox" name="dryrun" %s(PCK("dryrun"))> \ @ Dry run</label> @ <br><label><input type="checkbox" name="domod" %s(PCK("domod"))> \ @ Require moderator approval</label> @ <br><label><input type="checkbox" name="showqp" %s(PCK("showqp"))> \ @ Show query parameters</label> |
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); @ <form action="%R/forume2" method="POST"> @ <input type="hidden" name="fpid" value="%h(P("fpid"))"> @ <input type="hidden" name="nullout" value="1"> @ <input type="hidden" name="mimetype" value="%h(zMimetype)"> @ <input type="hidden" name="content" value="%h(zContent)"> if( zTitle ){ | | | 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | forum_render(zTitle, zMimetype, zContent,"forumEdit", 1); @ <form action="%R/forume2" method="POST"> @ <input type="hidden" name="fpid" value="%h(P("fpid"))"> @ <input type="hidden" name="nullout" value="1"> @ <input type="hidden" name="mimetype" value="%h(zMimetype)"> @ <input type="hidden" name="content" value="%h(zContent)"> if( zTitle ){ @ <input aria-label="Title" type="hidden" name="title" value="%h(zTitle)"> } }else if( P("edit") ){ /* Provide an edit to the fpid post */ zMimetype = P("mimetype"); zContent = PT("content"); zTitle = P("title"); if( zContent==0 ) zContent = fossil_strdup(pPost->zWiki); |
︙ | ︙ |
Changes to src/http_ssl.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ** of the server is held in global variables that are set by url_parse(). ** ** SSL support is abstracted out into this module because Fossil can ** be compiled without SSL support (which requires OpenSSL library) */ #include "config.h" #ifdef FOSSIL_ENABLE_SSL #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/x509.h> | > < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | ** of the server is held in global variables that are set by url_parse(). ** ** SSL support is abstracted out into this module because Fossil can ** be compiled without SSL support (which requires OpenSSL library) */ #include "config.h" #include "http_ssl.h" #ifdef FOSSIL_ENABLE_SSL #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/x509.h> #include <assert.h> #include <sys/types.h> /* ** There can only be a single OpenSSL IO connection open at a time. ** State information about that IO is stored in the following ** local variables: |
︙ | ︙ | |||
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | if ( cert==NULL ){ ssl_set_errmsg("No SSL certificate was presented by the peer"); ssl_close(); return 1; } if( !sslNoCertVerify && SSL_get_verify_result(ssl)!=X509_V_OK ){ char *desc, *prompt; Blob ans; char cReply; BIO *mem; unsigned char md[32]; char zHash[32*2+1]; unsigned int mdLength = (int)sizeof(md); memset(md, 0, sizeof(md)); zHash[0] = 0; | > > > | > > > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | if ( cert==NULL ){ ssl_set_errmsg("No SSL certificate was presented by the peer"); ssl_close(); return 1; } if( !sslNoCertVerify && SSL_get_verify_result(ssl)!=X509_V_OK ){ int x; char *desc, *prompt; Blob ans; char cReply; BIO *mem; unsigned char md[32]; char zHash[32*2+1]; unsigned int mdLength = (int)sizeof(md); memset(md, 0, sizeof(md)); zHash[0] = 0; /* MMNNFFPPS */ #if OPENSSL_VERSION_NUMBER >= 0x010000000 x = X509_digest(cert, EVP_sha256(), md, &mdLength); #else x = X509_digest(cert, EVP_sha1(), md, &mdLength); #endif if( x ){ int j; for(j=0; j<mdLength && j*2+1<sizeof(zHash); ++j){ zHash[j*2] = "0123456789abcdef"[md[j]>>4]; zHash[j*2+1] = "0123456789abcdef"[md[j]&0xf]; } zHash[j*2] = 0; } |
︙ | ︙ | |||
516 517 518 519 520 521 522 | ** ** remove-exception DOMAIN... Remove TLS cert exceptions ** for the domains listed. Or if ** the --all option is specified, ** remove all TLS cert exceptions. */ void test_tlsconfig_info(void){ | < < < > > > | > | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | ** ** remove-exception DOMAIN... Remove TLS cert exceptions ** for the domains listed. Or if ** the --all option is specified, ** remove all TLS cert exceptions. */ void test_tlsconfig_info(void){ #if !defined(FOSSIL_ENABLE_SSL) fossil_print("TLS disabled in this build\n"); #else const char *zCmd; size_t nCmd; int nHit = 0; db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); db_open_config(1,0); zCmd = g.argc>=3 ? g.argv[2] : "show"; nCmd = strlen(zCmd); if( strncmp("show",zCmd,nCmd)==0 ){ const char *zName, *zValue; size_t nName; Stmt q; fossil_print("OpenSSL-version: %s (0x%09x)\n", SSLeay_version(SSLEAY_VERSION), OPENSSL_VERSION_NUMBER); fossil_print("OpenSSL-cert-file: %s\n", X509_get_default_cert_file()); fossil_print("OpenSSL-cert-dir: %s\n", X509_get_default_cert_dir()); zName = X509_get_default_cert_file_env(); zValue = fossil_getenv(zName); if( zValue==0 ) zValue = ""; nName = strlen(zName); fossil_print("%s:%.*s%s\n", zName, 19-nName, "", zValue); |
︙ | ︙ |
Changes to src/info.c.
︙ | ︙ | |||
664 665 666 667 668 669 670 671 672 673 674 675 676 677 | const char *zComment; const char *zDate; const char *zOrigDate; int okWiki = 0; Blob wiki_read_links = BLOB_INITIALIZER; Blob wiki_add_links = BLOB_INITIALIZER; style_header("Check-in [%S]", zUuid); login_anonymous_available(); zEUser = db_text(0, "SELECT value FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_USER, rid); zEComment = db_text(0, | > | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | const char *zComment; const char *zDate; const char *zOrigDate; int okWiki = 0; Blob wiki_read_links = BLOB_INITIALIZER; Blob wiki_add_links = BLOB_INITIALIZER; Th_Store("current_checkin", zName); style_header("Check-in [%S]", zUuid); login_anonymous_available(); zEUser = db_text(0, "SELECT value FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_USER, rid); zEComment = db_text(0, |
︙ | ︙ | |||
1659 1660 1661 1662 1663 1664 1665 | login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); cookie_render(); if( P("from") && P("to") ){ | | | | 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); cookie_render(); if( P("from") && P("to") ){ v1 = artifact_from_ci_and_filename("from"); v2 = artifact_from_ci_and_filename("to"); }else{ Stmt q; v1 = name_to_rid_www("v1"); v2 = name_to_rid_www("v2"); /* If the two file versions being compared both have the same ** filename, then offer an "Annotate" link that constructs an |
︙ | ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | ** Return the uninterpreted content of an artifact. Used primarily ** to view artifacts that are images. */ void rawartifact_page(void){ int rid = 0; char *zUuid; | | | | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | ** Return the uninterpreted content of an artifact. Used primarily ** to view artifacts that are images. */ void rawartifact_page(void){ int rid = 0; char *zUuid; if( P("ci") ){ rid = artifact_from_ci_and_filename(0); } if( rid==0 ){ rid = name_to_rid_www("name"); } login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } if( rid==0 ) fossil_redirect_home(); |
︙ | ︙ | |||
1940 1941 1942 1943 1944 1945 1946 | style_footer(); } /* ** Look for "ci" and "filename" query parameters. If found, try to ** use them to extract the record ID of an artifact for the file. ** | | | | | | < < | < < | > > > > | | | < < < < < < | | | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 | style_footer(); } /* ** Look for "ci" and "filename" query parameters. If found, try to ** use them to extract the record ID of an artifact for the file. ** ** Also look for "fn" and "name" as an aliases for "filename". If any ** "filename" or "fn" or "name" are present but "ci" is missing, then ** use "tip" as the default value for "ci". ** ** If zNameParam is not NULL, then use that parameter as the filename ** rather than "fn" or "filename" or "name". the zNameParam is used ** for the from= and to= query parameters of /fdiff. */ int artifact_from_ci_and_filename(const char *zNameParam){ const char *zFilename; const char *zCI; int cirid; Manifest *pManifest; ManifestFile *pFile; int rid = 0; if( zNameParam ){ zFilename = P(zNameParam); }else{ zFilename = P("filename"); if( zFilename==0 ){ zFilename = P("fn"); } if( zFilename==0 ){ zFilename = P("name"); } } if( zFilename==0 ) return 0; zCI = PD("ci", "tip"); cirid = name_to_typed_rid(zCI, "ci"); if( cirid<=0 ) return 0; pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0); if( pManifest==0 ) return 0; manifest_file_rewind(pManifest); while( (pFile = manifest_file_next(pManifest,0))!=0 ){ if( fossil_strcmp(zFilename, pFile->zName)==0 ){ rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid); break; } } manifest_destroy(pManifest); return rid; } /* ** The "z" argument is a string that contains the text of a source code ** file. This routine appends that text to the HTTP reply with line numbering. ** ** zLn is the ?ln= parameter for the HTTP query. If there is an argument, |
︙ | ︙ | |||
2094 2095 2096 2097 2098 2099 2100 | ** ** ln - show line numbers ** ln=N - highlight line number N ** ln=M-N - highlight lines M through N inclusive ** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive) ** verbose - show more detail in the description ** download - redirect to the download (artifact page only) | | | > < | > | | | > > > > > > > > > < > | > | > | > | < < < < | | > > > | | < < | | < > > | < < < < < < | | | | | < < | > > > | < < > | | | > > > > > | < > | | < | | < | > > > | | | | | | | | | | | < < < < < < < < < | < | < | | | | | | | < < | < < < < < < < < > | > > > > | | > | | > | < > | > > > > > > > > < | < | | > > | 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 | ** ** ln - show line numbers ** ln=N - highlight line number N ** ln=M-N - highlight lines M through N inclusive ** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive) ** verbose - show more detail in the description ** download - redirect to the download (artifact page only) ** name=NAME - filename or hash as a query parameter ** filename=NAME - alternative spelling for "name=" ** fn=NAME - alternative spelling for "name=" ** ci=VERSION - The specific check-in to use with "name=" to ** identify the file. ** ** The /artifact page show the complete content of a file ** identified by HASH. The /whatis page shows only a description ** of how the artifact is used. The /file page shows the most recent ** version of the file or directory called NAME, or a list of the ** top-level directory if NAME is omitted. ** ** For /artifact and /whatis, the name= query parameter can refer to ** either the name of a file, or an artifact hash. If the ci= query ** parameter is also present, then name= must refer to a file name. ** If ci= is omitted, then the hash interpretation is preferred but ** if name= cannot be understood as a hash, a default "tip" value is ** used for ci=. ** ** For /file, name= can only be interpreted as a filename. As before, ** a default value of "tip" is used for ci= if ci= is omitted. */ void artifact_page(void){ int rid = 0; Blob content; const char *zMime; Blob downloadName; int renderAsWiki = 0; int renderAsHtml = 0; int objType; int asText; const char *zUuid = 0; u32 objdescFlags = OBJDESC_BASE; int descOnly = fossil_strcmp(g.zPath,"whatis")==0; int isFile = fossil_strcmp(g.zPath,"file")==0; const char *zLn = P("ln"); const char *zName = P("name"); const char *zCI = P("ci"); HQuery url; char *zCIUuid = 0; int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */ int isBranchCI = 0; /* ci= refers to a branch name */ char *zHeader = 0; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } /* Capture and normalize the name= and ci= query parameters */ if( zName==0 ){ zName = P("filename"); if( zName==0 ){ zName = P("fn"); } } if( zCI && strlen(zCI)==0 ){ zCI = 0; } if( zCI && name_to_uuid2(zCI, "ci", &zCIUuid) && sqlite3_strnicmp(zCIUuid, zCI, strlen(zCI))!=0 ){ isSymbolicCI = 1; isBranchCI = branch_includes_uuid(zCI, zCIUuid); } /* The name= query parameter (or at least one of its alternative ** spellings) is required. Except for /file, show a top-level ** directory listing if name= is omitted. */ if( zName==0 ){ if( isFile ){ if( P("ci")==0 ) cgi_set_query_parameter("ci","tip"); page_tree(); return; } style_header("Missing name= query parameter"); @ The name= query parameter is missing style_footer(); return; } url_initialize(&url, g.zPath); url_add_parameter(&url, "name", zName); url_add_parameter(&url, "ci", zCI); if( zCI==0 && !isFile ){ /* If there is no ci= query parameter, then prefer to interpret ** name= as a hash for /artifact and /whatis. But for not for /file. ** For /file, a name= without a ci= while prefer to use the default ** "tip" value for ci=. */ rid = name_to_rid(zName); } if( rid==0 ){ rid = artifact_from_ci_and_filename(0); } if( rid==0 ){ /* Artifact not found */ if( isFile ){ /* For /file, also check to see if name= refers to a directory, ** and if so, do a listing for that directory */ int nName = (int)strlen(zName); if( nName && zName[nName-1]=='/' ) nName--; if( db_exists( "SELECT 1 FROM filename" " WHERE name GLOB '%.*q/*' AND substr(name,1,%d)=='%.*q/';", nName, zName, nName+1, nName, zName ) ){ if( P("ci")==0 ) cgi_set_query_parameter("ci","tip"); page_tree(); return; } style_header("No such file"); @ File '%h(zName)' does not exist in this repository. }else{ style_header("No such artifact"); @ Artifact '%h(zName)' does not exist in this repository. } style_footer(); return; } if( descOnly || P("verbose")!=0 ){ url_add_parameter(&url, "verbose", "1"); objdescFlags |= OBJDESC_DETAIL; } zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); asText = P("txt")!=0; if( isFile ){ if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){ zCI = "tip"; @ <h2>File %z(href("%R/finfo?name=%T&m=tip",zName))%h(zName)</a> @ from the %z(href("%R/info/tip"))latest check-in</a></h2> }else{ const char *zPath; Blob path; blob_zero(&path); hyperlinked_path(zName, &path, zCI, "dir", "", LINKPATH_FINFO); zPath = blob_str(&path); @ <h2>File %s(zPath) \ if( isBranchCI ){ @ on branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2> }else if( isSymbolicCI ){ @ as of check-in %z(href("%R/info/%!S",zCIUuid))%s(zCI)</a></h2> }else{ @ as of check-in [%z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a>]</h2> } blob_reset(&path); } style_submenu_element("Artifact", "%R/artifact/%S", zUuid); style_submenu_element("Annotate", "%R/annotate?filename=%T&checkin=%T", zName, zCI); style_submenu_element("Blame", "%R/blame?filename=%T&checkin=%T", zName, zCI); blob_init(&downloadName, zName, -1); objType = OBJTYPE_CONTENT; }else{ @ <h2>Artifact style_copy_button(1, "hash-ar", 0, 2, "%s", zUuid); if( g.perm.Setup ){ @ (%d(rid)):</h2> }else{ @ :</h2> } blob_zero(&downloadName); if( asText ) objdescFlags &= ~OBJDESC_BASE; objType = object_description(rid, objdescFlags, (isFile?zName:0), &downloadName); } if( !descOnly && P("download")!=0 ){ cgi_redirectf("%R/raw/%T?name=%s", blob_str(&downloadName), db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid)); /*NOTREACHED*/ } if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
︙ | ︙ | |||
2287 2288 2289 2290 2291 2292 2293 | zHeader = mprintf("Artifact Description [%S]", zUuid); }else{ zHeader = mprintf("Artifact [%S]", zUuid); } style_header("%s", zHeader); fossil_free(zCIUuid); fossil_free(zHeader); | | | 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 | zHeader = mprintf("Artifact Description [%S]", zUuid); }else{ zHeader = mprintf("Artifact [%S]", zUuid); } style_header("%s", zHeader); fossil_free(zCIUuid); fossil_free(zHeader); if( !isFile && g.perm.Admin ){ Stmt q; db_prepare(&q, "SELECT coalesce(user.login,rcvfrom.uid)," " datetime(rcvfrom.mtime,toLocal()), rcvfrom.ipaddr" " FROM blob, rcvfrom LEFT JOIN user ON user.uid=rcvfrom.uid" " WHERE blob.rid=%d" " AND rcvfrom.rcvid=blob.rcvid;", rid); |
︙ | ︙ | |||
2767 2768 2769 2770 2771 2772 2773 | /* ** WEBPAGE: ci_edit ** ** Edit a check-in. (Check-ins are immutable and do not really change. ** This page really creates supplemental tags that affect the display ** of the check-in.) ** | | | | 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | /* ** WEBPAGE: ci_edit ** ** Edit a check-in. (Check-ins are immutable and do not really change. ** This page really creates supplemental tags that affect the display ** of the check-in.) ** ** Query parameters: ** ** rid=INTEGER Record ID of the check-in to edit (REQUIRED) ** ** POST parameters after pressing "Preview", "Cancel", or "Apply": ** ** c=TEXT New check-in comment ** u=TEXT New user name ** newclr Apply a background color ** clr=TEXT New background color (only if newclr) ** pclr Propagate new background color (only if newclr) ** dt=TEXT New check-in date/time (ISO8610 format) |
︙ | ︙ |
Changes to src/login.c.
︙ | ︙ | |||
676 677 678 679 680 681 682 | " WHERE login='anonymous'" " AND cap!=''"); }else{ zAnonPw = 0; } @ <table class="login_out"> @ <tr> | | < | < | < | > | | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | " WHERE login='anonymous'" " AND cap!=''"); }else{ zAnonPw = 0; } @ <table class="login_out"> @ <tr> @ <td class="form_label" id="userlabel1">User ID:</td> @ <td><input type="text" id="u" aria-labelledby="userlabel1" name="u" \ @ size="30" value="%s(anonFlag?"anonymous":"")"></td> @ </tr> @ <tr> @ <td class="form_label" id="pswdlabel">Password:</td> @ <td><input aria-labelledby="pswdlabel" type="password" id="p" \ @ name="p" value="" size="30" />\ if( zAnonPw && !noAnon ){ captcha_speakit_button(uSeed, "Speak password for \"anonymous\""); } @ </td> @ </tr> if( P("HTTPS")==0 ){ @ <tr><td class="form_label">Warning:</td> |
︙ | ︙ | |||
748 749 750 751 752 753 754 | @ for user <b>%h(g.zLogin)</b></p> } if( g.perm.Password ){ @ <hr> @ <p>Change Password for user <b>%h(g.zLogin)</b>:</p> form_begin(0, "%R/login"); @ <table> | | > | | > | | > | | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | @ for user <b>%h(g.zLogin)</b></p> } if( g.perm.Password ){ @ <hr> @ <p>Change Password for user <b>%h(g.zLogin)</b>:</p> form_begin(0, "%R/login"); @ <table> @ <tr><td class="form_label" id="oldpw">Old Password:</td> @ <td><input aria-labelledby="oldpw" type="password" name="p" \ @ size="30"/></td></tr> @ <tr><td class="form_label" id="newpw">New Password:</td> @ <td><input aria-labelledby="newpw" type="password" name="n1" \ @ size="30" /></td></tr> @ <tr><td class="form_label" id="reppw">Repeat New Password:</td> @ <td><input aria-labledby="reppw" type="password" name="n2" \ @ size="30" /></td></tr> @ <tr><td></td> @ <td><input type="submit" value="Change Password" /></td></tr> @ </table> @ </form> } } style_footer(); |
︙ | ︙ | |||
1688 1689 1690 1691 1692 1693 1694 | form_begin(0, "%R/register"); if( P("g") ){ @ <input type="hidden" name="g" value="%h(P("g"))" /> } @ <p><input type="hidden" name="captchaseed" value="%u(uSeed)" /> @ <table class="login_out"> @ <tr> | | > | | > | | > | | | | > | | > | | | | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | form_begin(0, "%R/register"); if( P("g") ){ @ <input type="hidden" name="g" value="%h(P("g"))" /> } @ <p><input type="hidden" name="captchaseed" value="%u(uSeed)" /> @ <table class="login_out"> @ <tr> @ <td class="form_label" align="right" id="uid">User ID:</td> @ <td><input aria-labelledby="uid" type="text" name="u" \ @ value="%h(zUserID)" size="30"></td> @ if( iErrLine==1 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } @ <tr> @ <td class="form_label" align="right" id="dpyname">Display Name:</td> @ <td><input aria-labelledby="dpyname" type="text" name="dn" \ @ value="%h(zDName)" size="30"></td> @ </tr> if( iErrLine==2 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } @ </tr> @ <tr> @ <td class="form_label" align="right" id="emaddr">Email Address:</td> @ <td><input aria-labelledby="emaddr" type="text" name="ea" \ @ value="%h(zEAddr)" size="30"></td> @ </tr> if( iErrLine==3 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } if( canDoAlerts ){ int a = atoi(PD("alerts","1")); @ <tr> @ <td class="form_label" align="right" id="emalrt">Email Alerts?</td> @ <td><select aria-labelledby="emalrt" size='1' name='alerts'> @ <option value="1" %s(a?"selected":"")>Yes</option> @ <option value="0" %s(!a?"selected":"")>No</option> @ </select></td></tr> } @ <tr> @ <td class="form_label" align="right" id="pswd">Password:</td> @ <td><input aria-labelledby="pswd" type="password" name="p" \ @ value="%h(zPasswd)" size="30"></td> @ <tr> if( iErrLine==4 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } @ <tr> @ <td class="form_label" align="right" id="pwcfrm">Confirm:</td> @ <td><input aria-labelledby="pwcfrm" type="password" name="cp" \ @ value="%h(zConfirm)" size="30"></td> @ </tr> if( iErrLine==5 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } @ <tr> @ <td class="form_label" align="right" id="cptcha">Captcha:</td> @ <td><input type="text" name="captcha" aria-labelledby="cptcha" \ @ value="%h(captchaIsCorrect?zDecoded:"")" size="30"> captcha_speakit_button(uSeed, "Speak the captcha text"); @ </td> @ </tr> if( iErrLine==6 ){ @ <tr><td><td><span class='loginError'>↑ %h(zErr)</span></td></tr> } |
︙ | ︙ |
Changes to src/printf.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** %S Prefix of a length appropriate for human display ** ** The following macros help determine those lengths. FOSSIL_HASH_DIGITS ** is the default number of digits to display to humans. This value can ** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL ** is the minimum number of digits to be used in URLs. The number used ** will always be at least 6 more than the number used for human output, | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ** %S Prefix of a length appropriate for human display ** ** The following macros help determine those lengths. FOSSIL_HASH_DIGITS ** is the default number of digits to display to humans. This value can ** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL ** is the minimum number of digits to be used in URLs. The number used ** will always be at least 6 more than the number used for human output, ** or HNAME_MAX, whichever is least. */ #ifndef FOSSIL_HASH_DIGITS # define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */ #endif #ifndef FOSSIL_HASH_DIGITS_URL # define FOSSIL_HASH_DIGITS_URL 16 /* For %!S (embedded in URLs) */ #endif /* ** Return the number of artifact hash digits to display. The number is for ** human output if the bForUrl is false and is destined for a URL if ** bForUrl is false. */ int hash_digits(int bForUrl){ static int nDigitHuman = 0; static int nDigitUrl = 0; if( nDigitHuman==0 ){ nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS); if( nDigitHuman < 6 ) nDigitHuman = 6; if( nDigitHuman > HNAME_MAX ) nDigitHuman = HNAME_MAX; nDigitUrl = nDigitHuman + 6; if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL; if( nDigitUrl > HNAME_MAX ) nDigitUrl = HNAME_MAX; } return bForUrl ? nDigitUrl : nDigitHuman; } /* ** Return the number of characters in a %S output. */ |
︙ | ︙ |
Changes to src/setup.c.
︙ | ︙ | |||
199 200 201 202 203 204 205 | login_verify_csrf_secret(); db_set(zVar, iQ ? "1" : "0", 0); admin_log("Set option [%q] to [%q].", zVar, iQ ? "on" : "off"); iVal = iQ; } } | | > | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | login_verify_csrf_secret(); db_set(zVar, iQ ? "1" : "0", 0); admin_log("Set option [%q] to [%q].", zVar, iQ ? "on" : "off"); iVal = iQ; } } @ <label><input type="checkbox" name="%s(zQParm)" \ @ aria-label="%s(zLabel[0]?zLabel:zQParm)" \ if( iVal ){ @ checked="checked" \ } if( disabled ){ @ disabled="disabled" \ } @ /> <b>%s(zLabel)</b></label> } /* ** Generate an entry box for an attribute. */ |
︙ | ︙ | |||
230 231 232 233 234 235 236 | const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set entry_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); zVal = zQ; } | > | < | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set entry_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); zVal = zQ; } @ <input aria-label="%h(zLabel[0]?zLabel:zQParm)" type="text" \ @ id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)" \ if( disabled ){ @ disabled="disabled" \ } @ /> <b>%s(zLabel)</b> } /* |
︙ | ︙ | |||
261 262 263 264 265 266 267 | login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set textarea_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); z = zQ; } if( rows>0 && cols>0 ){ | | > | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set textarea_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); z = zQ; } if( rows>0 && cols>0 ){ @ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)" \ @ aria-label="%h(zLabel[0]?zLabel:zQP)" \ if( disabled ){ @ disabled="disabled" \ } @ cols="%d(cols)">%h(z)</textarea> if( *zLabel ){ @ <span class="textareaLabel">%s(zLabel)</span> } } return z; } /* |
︙ | ︙ | |||
295 296 297 298 299 300 301 | const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set multiple_choice_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); z = zQ; } | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set multiple_choice_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); z = zQ; } @ <select aria-label="%h(zLabel)" size="1" name="%s(zQP)" id="id%s(zQP)"> for(i=0; i<nChoice*2; i+=2){ const char *zSel = fossil_strcmp(azChoice[i],z)==0 ? " selected" : ""; @ <option value="%h(azChoice[i])"%s(zSel)>%h(azChoice[i+1])</option> } @ </select> <b>%h(zLabel)</b> } |
︙ | ︙ | |||
396 397 398 399 400 401 402 | @ </p> @ @ <hr /> onoff_attribute("Allow HTTP_AUTHENTICATION authentication", "http_authentication_ok", "http_authentication_ok", 0, 0); @ <p>When enabled, allow the use of the HTTP_AUTHENTICATION environment @ variable or the "Authentication:" HTTP header to find the username and | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | @ </p> @ @ <hr /> onoff_attribute("Allow HTTP_AUTHENTICATION authentication", "http_authentication_ok", "http_authentication_ok", 0, 0); @ <p>When enabled, allow the use of the HTTP_AUTHENTICATION environment @ variable or the "Authentication:" HTTP header to find the username and @ password. This is another way of supporting Basic Authentication. @ (Property: "http_authentication_ok") @ </p> @ @ <hr /> entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766", 0); @ <p>The number of hours for which a login is valid. This must be a |
︙ | ︙ | |||
604 605 606 607 608 609 610 | @ is not currently part of any login-group. @ To join a login group, fill out the form below.</p> @ @ <form action="%s(g.zTop)/setup_login_group" method="post"><div> login_insert_csrf_secret(); @ <blockquote><table border="0"> @ | > | > | | > | | | > | > | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | @ is not currently part of any login-group. @ To join a login group, fill out the form below.</p> @ @ <form action="%s(g.zTop)/setup_login_group" method="post"><div> login_insert_csrf_secret(); @ <blockquote><table border="0"> @ @ <tr><th align="right" id="rfigtj">Repository filename \ @ in group to join:</th> @ <td width="5"></td><td> @ <input aria-labelledby="rfigtj" type="text" size="50" \ @ value="%h(zRepo)" name="repo"></td></tr> @ @ <tr><th align="right" id="lotar">Login on the above repo:</th> @ <td width="5"></td><td> @ <input aria-labelledby="lotar" type="text" size="20" \ @ value="%h(zLogin)" name="login"></td></tr> @ @ <tr><th align="right" id="lgpw">Password:</th> @ <td width="5"></td><td> @ <input aria-labelledby="lgpw" type="password" size="20" name="pw">\ @ </td></tr> @ @ <tr><th align="right" id="nolg">Name of login-group:</th> @ <td width="5"></td><td> @ <input aria-labelledby="nolg" type="text" size="30" \ @ value="%h(zNewName)" name="newname"> @ (only used if creating a new login-group).</td></tr> @ @ <tr><td colspan="3" align="center"> @ <input type="submit" value="Join" name="join"></td></tr> @ </table></blockquote></div></form> }else{ Stmt q; |
︙ | ︙ |
Changes to src/setupuser.c.
︙ | ︙ | |||
532 533 534 535 536 537 538 | @ <input type="hidden" name="login" value="%s(zLogin)"> @ <input type="hidden" name="info" value=""> @ <input type="hidden" name="pw" value="*"> } @ <input type="hidden" name="referer" value="%h(cgi_referer("setup_ulist"))"> @ <table width="100%%"> @ <tr> | | > | > | | > | | > | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | @ <input type="hidden" name="login" value="%s(zLogin)"> @ <input type="hidden" name="info" value=""> @ <input type="hidden" name="pw" value="*"> } @ <input type="hidden" name="referer" value="%h(cgi_referer("setup_ulist"))"> @ <table width="100%%"> @ <tr> @ <td class="usetupEditLabel" id="suuid">User ID:</td> if( uid ){ @ <td>%d(uid) <input aria-labelledby="suuid" type="hidden" \ @ name="id" value="%d(uid)"/>\ @ </td> }else{ @ <td>(new user)<input aria-labelledby="suuid" type="hidden" name="id" \ @ value="0" /></td> } @ </tr> @ <tr> @ <td class="usetupEditLabel" id="sulgn">Login:</td> if( login_is_special(zLogin) ){ @ <td><b>%h(zLogin)</b></td> }else{ @ <td><input aria-labelledby="sulgn" type="text" name="login" \ @ value="%h(zLogin)" /> if( alert_tables_exist() ){ int sid; sid = db_int(0, "SELECT subscriberId FROM subscriber" " WHERE suname=%Q", zLogin); if( sid>0 ){ @ <a href="%R/alerts?sid=%d(sid)">\ @ (subscription info for %h(zLogin))</a>\ } } @ </td></tr> @ <tr> @ <td class="usetupEditLabel" id="sucnfo">Contact Info:</td> @ <td><textarea aria-labelledby="sucnfo" name="info" cols="40" \ @ rows="2">%h(zInfo)</textarea></td> } @ </tr> @ <tr> @ <td class="usetupEditLabel">Capabilities:</td> @ <td width="100%%"> #define B(x) inherit[x] @ <div class="columns" style="column-width:13em;"> |
︙ | ︙ | |||
651 652 653 654 655 656 657 | @ <td> @ <span id="usetupEditCapability">(missing JS?)</span> @ <a href="%R/setup_ucap_list">(key)</a> @ </td> @ </tr> if( !login_is_special(zLogin) ){ @ <tr> | | | | | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | @ <td> @ <span id="usetupEditCapability">(missing JS?)</span> @ <a href="%R/setup_ucap_list">(key)</a> @ </td> @ </tr> if( !login_is_special(zLogin) ){ @ <tr> @ <td align="right" id="supw">Password:</td> if( zPw[0] ){ /* Obscure the password for all users */ @ <td><input aria-labelledby="supw" type="password" autocomplete="off" \ @ name="pw" value="**********" /></td> }else{ /* Show an empty password as an empty input field */ @ <td><input aria-labelledby="supw" type="password" name="pw" \ @ autocomplete="off" value="" /></td> } @ </tr> } zGroup = login_group_name(); if( zGroup ){ @ <tr> @ <td valign="top" align="right">Scope:</td> |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
7996 7997 7998 7999 8000 8001 8002 | "EXPLAIN QUERY PLAN %s", pStmt->zSql ); while( rc==SQLITE_OK && sqlite3_step(pExplain)==SQLITE_ROW ){ /* int iId = sqlite3_column_int(pExplain, 0); */ /* int iParent = sqlite3_column_int(pExplain, 1); */ /* int iNotUsed = sqlite3_column_int(pExplain, 2); */ const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3); | | > > > | 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 | "EXPLAIN QUERY PLAN %s", pStmt->zSql ); while( rc==SQLITE_OK && sqlite3_step(pExplain)==SQLITE_ROW ){ /* int iId = sqlite3_column_int(pExplain, 0); */ /* int iParent = sqlite3_column_int(pExplain, 1); */ /* int iNotUsed = sqlite3_column_int(pExplain, 2); */ const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3); int nDetail; int i; if( !zDetail ) continue; nDetail = STRLEN(zDetail); for(i=0; i<nDetail; i++){ const char *zIdx = 0; if( memcmp(&zDetail[i], " USING INDEX ", 13)==0 ){ zIdx = &zDetail[i+13]; }else if( memcmp(&zDetail[i], " USING COVERING INDEX ", 22)==0 ){ zIdx = &zDetail[i+22]; } |
︙ | ︙ | |||
8818 8819 8820 8821 8822 8823 8824 | idxWriteFree(p->pWrite); idxHashClear(&p->hIdx); sqlite3_free(p->zCandidates); sqlite3_free(p); } } | | | 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 | idxWriteFree(p->pWrite); idxHashClear(&p->hIdx); sqlite3_free(p->zCandidates); sqlite3_free(p); } } #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ /************************* End ../ext/expert/sqlite3expert.c ********************/ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) /************************* Begin ../ext/misc/dbdata.c ******************/ /* ** 2019-04-17 |
︙ | ︙ |
Changes to src/shun.c.
︙ | ︙ | |||
185 186 187 188 189 190 191 | @ or artifacts that by design or accident interfere with the processing @ of the repository. Do not shun artifacts merely to remove them from @ sight - set the "hidden" tag on such artifacts instead.</p> @ @ <blockquote> @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> login_insert_csrf_secret(); | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | @ or artifacts that by design or accident interfere with the processing @ of the repository. Do not shun artifacts merely to remove them from @ sight - set the "hidden" tag on such artifacts instead.</p> @ @ <blockquote> @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> login_insert_csrf_secret(); @ <textarea class="fullsize-text" cols="70" rows="%d(numRows)" name="uuid"> if( zShun ){ if( strlen(zShun) ){ @ %h(zShun) }else if( nRcvid ){ db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); while( db_step(&q)==SQLITE_ROW ){ @ %s(db_column_text(&q, 0)) |
︙ | ︙ | |||
212 213 214 215 216 217 218 | @ restored because the content is unknown. The only change is that @ the formerly shunned artifacts will be accepted on subsequent sync @ operations.</p> @ @ <blockquote> @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> login_insert_csrf_secret(); | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | @ restored because the content is unknown. The only change is that @ the formerly shunned artifacts will be accepted on subsequent sync @ operations.</p> @ @ <blockquote> @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> login_insert_csrf_secret(); @ <textarea class="fullsize-text" cols="70" rows="%d(numRows)" name="uuid"> if( zAccept ){ if( strlen(zAccept) ){ @ %h(zAccept) }else if( nRcvid ){ db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); while( db_step(&q)==SQLITE_ROW ){ @ %s(db_column_text(&q, 0)) |
︙ | ︙ |
Changes to src/skins.c.
︙ | ︙ | |||
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | /* ** Return an identifier that is (probably) different for every skin ** but that is (probably) the same if the skin is unchanged. This ** identifier can be attached to resource URLs to force reloading when ** the resources change but allow the resources to be read from cache ** as long as they are unchanged. */ unsigned int skin_id(const char *zResource){ unsigned int h = 0; if( zAltSkinDir ){ h = skin_hash(0, zAltSkinDir); }else if( pAltSkin ){ h = skin_hash(0, pAltSkin->zLabel); }else{ char *zMTime = db_get_mtime(zResource, 0, 0); h = skin_hash(0, zMTime); fossil_free(zMTime); } | > > > > > | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | /* ** Return an identifier that is (probably) different for every skin ** but that is (probably) the same if the skin is unchanged. This ** identifier can be attached to resource URLs to force reloading when ** the resources change but allow the resources to be read from cache ** as long as they are unchanged. ** ** The zResource argument is the name of a CONFIG setting that ** defines the resource. Examples: "css", "logo-image". */ unsigned int skin_id(const char *zResource){ unsigned int h = 0; if( zAltSkinDir ){ h = skin_hash(0, zAltSkinDir); }else if( pAltSkin ){ h = skin_hash(0, pAltSkin->zLabel); }else{ char *zMTime = db_get_mtime(zResource, 0, 0); h = skin_hash(0, zMTime); fossil_free(zMTime); } /* Change the ID every time Fossil is recompiled */ h = skin_hash(h, fossil_exe_id()); return h; } /* ** For a skin named zSkinName, compute the name of the CONFIG table ** entry where that skin is stored and return it. ** |
︙ | ︙ | |||
1115 1116 1117 1118 1119 1120 1121 | @ <h1>Step 7: Publish</h1> @ if( !g.perm.Admin ){ @ <p>Only administrators are allowed to publish draft skins. Contact @ an administrator to get this "draft%d(iSkin)" skin published.</p> }else{ @ <p>When the draft%d(iSkin) skin is ready for production use, | | | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | @ <h1>Step 7: Publish</h1> @ if( !g.perm.Admin ){ @ <p>Only administrators are allowed to publish draft skins. Contact @ an administrator to get this "draft%d(iSkin)" skin published.</p> }else{ @ <p>When the draft%d(iSkin) skin is ready for production use, @ make it the default skin by clicking the acknowledgements and @ pressing the button below:</p> @ @ <form method='POST' action='%R/setup_skin#step7'> @ <p class='skinInput'> @ <input type='hidden' name='sk' value='%d(iSkin)'> @ <input type='checkbox' name='pub7ck1' value='yes'>\ @ Skin draft%d(iSkin) has been tested and found ready for production.<br> |
︙ | ︙ |
Changes to src/sqlite3.c.
︙ | ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.32.0" #define SQLITE_VERSION_NUMBER 3032000 | | | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.32.0" #define SQLITE_VERSION_NUMBER 3032000 #define SQLITE_SOURCE_ID "2020-05-19 15:51:10 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad40bde" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
6530 6531 6532 6533 6534 6535 6536 | ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the | | | 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 | ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the ** value of N in any subsequent call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ Within the xFinal callback, it is customary to set ** N=0 in calls to sqlite3_aggregate_context(C,N) so that no ** pointless memory allocations occur. ** ** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. |
︙ | ︙ | |||
17117 17118 17119 17120 17121 17122 17123 | #define SQLITE_FUNC_LIKE 0x0004 /* Candidate for the LIKE optimization */ #define SQLITE_FUNC_CASE 0x0008 /* Case-sensitive LIKE-type function */ #define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */ #define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq() might be called*/ #define SQLITE_FUNC_LENGTH 0x0040 /* Built-in length() function */ #define SQLITE_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */ #define SQLITE_FUNC_COUNT 0x0100 /* Built-in count(*) aggregate */ | | > | 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 | #define SQLITE_FUNC_LIKE 0x0004 /* Candidate for the LIKE optimization */ #define SQLITE_FUNC_CASE 0x0008 /* Case-sensitive LIKE-type function */ #define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */ #define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq() might be called*/ #define SQLITE_FUNC_LENGTH 0x0040 /* Built-in length() function */ #define SQLITE_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */ #define SQLITE_FUNC_COUNT 0x0100 /* Built-in count(*) aggregate */ /* 0x0200 -- available for reuse */ #define SQLITE_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */ #define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */ #define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */ #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a ** single query - might change over time */ #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */ #define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */ #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */ #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */ #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */ #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */ #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */ #define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */ /* Identifier numbers for each in-line function */ #define INLINEFUNC_coalesce 0 #define INLINEFUNC_implies_nonnull_row 1 #define INLINEFUNC_expr_implies_expr 2 #define INLINEFUNC_expr_compare 3 #define INLINEFUNC_affinity 4 #define INLINEFUNC_iif 5 #define INLINEFUNC_unlikely 99 /* Default case */ /* ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are ** used to create the initializers for the FuncDef structures. ** ** FUNCTION(zName, nArg, iArg, bNC, xFunc) |
︙ | ︙ | |||
20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 | void(*)(void*) ); # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) #endif SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); #ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); #else # define sqlite3ShadowTableName(A,B) 0 #endif SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*); SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*); | > > | 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 | void(*)(void*) ); # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) #endif SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); #ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3*,Table*,const char*); #else # define sqlite3ShadowTableName(A,B) 0 # define sqlite3IsShadowTableOf(A,B,C) 0 #endif SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*); SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*); |
︙ | ︙ | |||
27922 27923 27924 27925 27926 27927 27928 | memcpy(pNew, p, lookasideMallocSize(db, p)); sqlite3DbFree(db, p); } }else{ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); sqlite3MemdebugSetType(p, MEMTYPE_HEAP); | | | 27925 27926 27927 27928 27929 27930 27931 27932 27933 27934 27935 27936 27937 27938 27939 | memcpy(pNew, p, lookasideMallocSize(db, p)); sqlite3DbFree(db, p); } }else{ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); sqlite3MemdebugSetType(p, MEMTYPE_HEAP); pNew = sqlite3Realloc(p, n); if( !pNew ){ sqlite3OomFault(db); } sqlite3MemdebugSetType(pNew, (db->lookaside.bDisable==0 ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP)); } } |
︙ | ︙ | |||
28999 29000 29001 29002 29003 29004 29005 | return 0; }else{ p->nAlloc = (int)szNew; } if( p->db ){ zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc); }else{ | | | 29002 29003 29004 29005 29006 29007 29008 29009 29010 29011 29012 29013 29014 29015 29016 | return 0; }else{ p->nAlloc = (int)szNew; } if( p->db ){ zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc); }else{ zNew = sqlite3Realloc(zOld, p->nAlloc); } if( zNew ){ assert( p->zText!=0 || p->nChar==0 ); if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); p->zText = zNew; p->nAlloc = sqlite3DbMallocSize(p->db, zNew); p->printfFlags |= SQLITE_PRINTF_MALLOCED; |
︙ | ︙ | |||
29341 29342 29343 29344 29345 29346 29347 | ** A version of printf() that understands %lld. Used for debugging. ** The printf() built into some versions of windows does not understand %lld ** and segfaults if you give it a long long int. */ SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ va_list ap; StrAccum acc; | | | 29344 29345 29346 29347 29348 29349 29350 29351 29352 29353 29354 29355 29356 29357 29358 | ** A version of printf() that understands %lld. Used for debugging. ** The printf() built into some versions of windows does not understand %lld ** and segfaults if you give it a long long int. */ SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ va_list ap; StrAccum acc; char zBuf[SQLITE_PRINT_BUF_SIZE*10]; sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); va_start(ap,zFormat); sqlite3_str_vappendf(&acc, zFormat, ap); va_end(ap); sqlite3StrAccumFinish(&acc); #ifdef SQLITE_OS_TRACE_PROC { |
︙ | ︙ | |||
45046 45047 45048 45049 45050 45051 45052 45053 45054 45055 45056 45057 45058 45059 | pFile->ctrlFlags |= mask; } } /* Forward references to VFS helper methods used for temporary files */ static int winGetTempname(sqlite3_vfs *, char **); static int winIsDir(const void *); static BOOL winIsDriveLetterAndColon(const char *); /* ** Control and query of the open file handle. */ static int winFileControl(sqlite3_file *id, int op, void *pArg){ winFile *pFile = (winFile*)id; | > | 45049 45050 45051 45052 45053 45054 45055 45056 45057 45058 45059 45060 45061 45062 45063 | pFile->ctrlFlags |= mask; } } /* Forward references to VFS helper methods used for temporary files */ static int winGetTempname(sqlite3_vfs *, char **); static int winIsDir(const void *); static BOOL winIsLongPathPrefix(const char *); static BOOL winIsDriveLetterAndColon(const char *); /* ** Control and query of the open file handle. */ static int winFileControl(sqlite3_file *id, int op, void *pArg){ winFile *pFile = (winFile*)id; |
︙ | ︙ | |||
46815 46816 46817 46818 46819 46820 46821 | sqlite3_free(zTmpname); pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; pFile->pVfs = pVfs; pFile->h = h; if( isReadonly ){ pFile->ctrlFlags |= WINFILE_RDONLY; } | > | > | 46819 46820 46821 46822 46823 46824 46825 46826 46827 46828 46829 46830 46831 46832 46833 46834 46835 | sqlite3_free(zTmpname); pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; pFile->pVfs = pVfs; pFile->h = h; if( isReadonly ){ pFile->ctrlFlags |= WINFILE_RDONLY; } if( (flags & SQLITE_OPEN_MAIN_DB) && sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pFile->ctrlFlags |= WINFILE_PSOW; } pFile->lastErrno = NO_ERROR; pFile->zPath = zName; #if SQLITE_MAX_MMAP_SIZE>0 pFile->hMap = NULL; pFile->pMapRegion = 0; |
︙ | ︙ | |||
47024 47025 47026 47027 47028 47029 47030 47031 47032 47033 47034 47035 47036 47037 | assert(!"Invalid flags argument"); } *pResOut = rc; OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", zFilename, pResOut, *pResOut)); return SQLITE_OK; } /* ** Returns non-zero if the specified path name starts with a drive letter ** followed by a colon character. */ static BOOL winIsDriveLetterAndColon( const char *zPathname | > > > > > > > > > > > | 47030 47031 47032 47033 47034 47035 47036 47037 47038 47039 47040 47041 47042 47043 47044 47045 47046 47047 47048 47049 47050 47051 47052 47053 47054 | assert(!"Invalid flags argument"); } *pResOut = rc; OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", zFilename, pResOut, *pResOut)); return SQLITE_OK; } /* ** Returns non-zero if the specified path name starts with the "long path" ** prefix. */ static BOOL winIsLongPathPrefix( const char *zPathname ){ return ( zPathname[0]=='\\' && zPathname[1]=='\\' && zPathname[2]=='?' && zPathname[3]=='\\' ); } /* ** Returns non-zero if the specified path name starts with a drive letter ** followed by a colon character. */ static BOOL winIsDriveLetterAndColon( const char *zPathname |
︙ | ︙ | |||
47089 47090 47091 47092 47093 47094 47095 | ){ #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) DWORD nByte; void *zConverted; char *zOut; #endif | | | | > | 47106 47107 47108 47109 47110 47111 47112 47113 47114 47115 47116 47117 47118 47119 47120 47121 47122 47123 47124 | ){ #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) DWORD nByte; void *zConverted; char *zOut; #endif /* If this path name begins with "/X:" or "\\?\", where "X" is any ** alphabetic character, discard the initial "/" from the pathname. */ if( zRelative[0]=='/' && (winIsDriveLetterAndColon(zRelative+1) || winIsLongPathPrefix(zRelative+1)) ){ zRelative++; } #if defined(__CYGWIN__) SimulateIOError( return SQLITE_ERROR ); UNUSED_PARAMETER(nFull); assert( nFull>=pVfs->mxPathname ); |
︙ | ︙ | |||
47848 47849 47850 47851 47852 47853 47854 | return SQLITE_FULL; } if( newSz>p->szMax ){ return SQLITE_FULL; } newSz *= 2; if( newSz>p->szMax ) newSz = p->szMax; | | | 47866 47867 47868 47869 47870 47871 47872 47873 47874 47875 47876 47877 47878 47879 47880 | return SQLITE_FULL; } if( newSz>p->szMax ){ return SQLITE_FULL; } newSz *= 2; if( newSz>p->szMax ) newSz = p->szMax; pNew = sqlite3Realloc(p->aData, newSz); if( pNew==0 ) return SQLITE_NOMEM; p->aData = pNew; p->szAlloc = newSz; return SQLITE_OK; } /* |
︙ | ︙ | |||
59818 59819 59820 59821 59822 59823 59824 | ){ int rc = SQLITE_OK; /* Enlarge the pWal->apWiData[] array if required */ if( pWal->nWiData<=iPage ){ sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); volatile u32 **apNew; | | | 59836 59837 59838 59839 59840 59841 59842 59843 59844 59845 59846 59847 59848 59849 59850 | ){ int rc = SQLITE_OK; /* Enlarge the pWal->apWiData[] array if required */ if( pWal->nWiData<=iPage ){ sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); volatile u32 **apNew; apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); if( !apNew ){ *ppPage = 0; return SQLITE_NOMEM_BKPT; } memset((void*)&apNew[pWal->nWiData], 0, sizeof(u32*)*(iPage+1-pWal->nWiData)); pWal->apWiData = apNew; |
︙ | ︙ | |||
59939 59940 59941 59942 59943 59944 59945 59946 59947 59948 59949 59950 59951 59952 59953 59954 59955 59956 | }while( aData<aEnd ); } aOut[0] = s1; aOut[1] = s2; } static void walShmBarrier(Wal *pWal){ if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){ sqlite3OsShmBarrier(pWal->pDbFd); } } /* ** Write the header information in pWal->hdr into the wal-index. ** ** The checksum on pWal->hdr is updated before it is written. */ | > > > > > > > > > > > > > > > > > | > | 59957 59958 59959 59960 59961 59962 59963 59964 59965 59966 59967 59968 59969 59970 59971 59972 59973 59974 59975 59976 59977 59978 59979 59980 59981 59982 59983 59984 59985 59986 59987 59988 59989 59990 59991 59992 59993 59994 59995 59996 59997 59998 59999 60000 60001 60002 60003 60004 60005 60006 60007 | }while( aData<aEnd ); } aOut[0] = s1; aOut[1] = s2; } /* ** If there is the possibility of concurrent access to the SHM file ** from multiple threads and/or processes, then do a memory barrier. */ static void walShmBarrier(Wal *pWal){ if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){ sqlite3OsShmBarrier(pWal->pDbFd); } } /* ** Add the SQLITE_NO_TSAN as part of the return-type of a function ** definition as a hint that the function contains constructs that ** might give false-positive TSAN warnings. ** ** See tag-20200519-1. */ #if defined(__clang__) && !defined(SQLITE_NO_TSAN) # define SQLITE_NO_TSAN __attribute__((no_sanitize_thread)) #else # define SQLITE_NO_TSAN #endif /* ** Write the header information in pWal->hdr into the wal-index. ** ** The checksum on pWal->hdr is updated before it is written. */ static SQLITE_NO_TSAN void walIndexWriteHdr(Wal *pWal){ volatile WalIndexHdr *aHdr = walIndexHdr(pWal); const int nCksum = offsetof(WalIndexHdr, aCksum); assert( pWal->writeLock ); pWal->hdr.isInit = 1; pWal->hdr.iVersion = WALINDEX_MAX_VERSION; walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum); /* Possible TSAN false-positive. See tag-20200519-1 */ memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr)); walShmBarrier(pWal); memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr)); } /* ** This function encodes a single frame header and writes it to a buffer |
︙ | ︙ | |||
61072 61073 61074 61075 61076 61077 61078 | int i; /* Loop counter */ u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */ pWal->nCkpt++; pWal->hdr.mxFrame = 0; sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0])); memcpy(&pWal->hdr.aSalt[1], &salt1, 4); walIndexWriteHdr(pWal); | | | 61108 61109 61110 61111 61112 61113 61114 61115 61116 61117 61118 61119 61120 61121 61122 | int i; /* Loop counter */ u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */ pWal->nCkpt++; pWal->hdr.mxFrame = 0; sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0])); memcpy(&pWal->hdr.aSalt[1], &salt1, 4); walIndexWriteHdr(pWal); AtomicStore(&pInfo->nBackfill, 0); pInfo->nBackfillAttempted = 0; pInfo->aReadMark[1] = 0; for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED; assert( pInfo->aReadMark[0]==0 ); } /* |
︙ | ︙ | |||
61147 61148 61149 61150 61151 61152 61153 | ** safe to write into the database. Frames beyond mxSafeFrame might ** overwrite database pages that are in use by active readers and thus ** cannot be backfilled from the WAL. */ mxSafeFrame = pWal->hdr.mxFrame; mxPage = pWal->hdr.nPage; for(i=1; i<WAL_NREADER; i++){ | < < < < < < < < < < < < < < < < < < < < | | > | | 61183 61184 61185 61186 61187 61188 61189 61190 61191 61192 61193 61194 61195 61196 61197 61198 61199 61200 61201 61202 61203 61204 61205 61206 61207 61208 61209 61210 61211 61212 61213 61214 61215 61216 61217 61218 61219 61220 61221 | ** safe to write into the database. Frames beyond mxSafeFrame might ** overwrite database pages that are in use by active readers and thus ** cannot be backfilled from the WAL. */ mxSafeFrame = pWal->hdr.mxFrame; mxPage = pWal->hdr.nPage; for(i=1; i<WAL_NREADER; i++){ u32 y = AtomicLoad(pInfo->aReadMark+i); if( mxSafeFrame>y ){ assert( y<=pWal->hdr.mxFrame ); rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1); if( rc==SQLITE_OK ){ u32 iMark = (i==1 ? mxSafeFrame : READMARK_NOT_USED); AtomicStore(pInfo->aReadMark+i, iMark); walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); }else if( rc==SQLITE_BUSY ){ mxSafeFrame = y; xBusy = 0; }else{ goto walcheckpoint_out; } } } /* Allocate the iterator */ if( pInfo->nBackfill<mxSafeFrame ){ rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter); assert( rc==SQLITE_OK || pIter==0 ); } if( pIter && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK ){ u32 nBackfill = pInfo->nBackfill; pInfo->nBackfillAttempted = mxSafeFrame; /* Sync the WAL to disk */ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); |
︙ | ︙ | |||
61246 61247 61248 61249 61250 61251 61252 | testcase( IS_BIG_INT(szDb) ); rc = sqlite3OsTruncate(pWal->pDbFd, szDb); if( rc==SQLITE_OK ){ rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); } } if( rc==SQLITE_OK ){ | | | 61263 61264 61265 61266 61267 61268 61269 61270 61271 61272 61273 61274 61275 61276 61277 | testcase( IS_BIG_INT(szDb) ); rc = sqlite3OsTruncate(pWal->pDbFd, szDb); if( rc==SQLITE_OK ){ rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); } } if( rc==SQLITE_OK ){ AtomicStore(&pInfo->nBackfill, mxSafeFrame); } } /* Release the reader lock held while backfilling */ walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); } |
︙ | ︙ | |||
61405 61406 61407 61408 61409 61410 61411 | ** If and only if the read is consistent and the header is different from ** pWal->hdr, then pWal->hdr is updated to the content of the new header ** and *pChanged is set to 1. ** ** If the checksum cannot be verified return non-zero. If the header ** is read successfully and the checksum verified, return zero. */ | | > | > > > > > | | 61422 61423 61424 61425 61426 61427 61428 61429 61430 61431 61432 61433 61434 61435 61436 61437 61438 61439 61440 61441 61442 61443 61444 61445 61446 61447 61448 61449 61450 61451 61452 61453 61454 61455 61456 61457 61458 61459 61460 61461 | ** If and only if the read is consistent and the header is different from ** pWal->hdr, then pWal->hdr is updated to the content of the new header ** and *pChanged is set to 1. ** ** If the checksum cannot be verified return non-zero. If the header ** is read successfully and the checksum verified, return zero. */ static SQLITE_NO_TSAN int walIndexTryHdr(Wal *pWal, int *pChanged){ u32 aCksum[2]; /* Checksum on the header content */ WalIndexHdr h1, h2; /* Two copies of the header content */ WalIndexHdr volatile *aHdr; /* Header in shared memory */ /* The first page of the wal-index must be mapped at this point. */ assert( pWal->nWiData>0 && pWal->apWiData[0] ); /* Read the header. This might happen concurrently with a write to the ** same area of shared memory on a different CPU in a SMP, ** meaning it is possible that an inconsistent snapshot is read ** from the file. If this happens, return non-zero. ** ** tag-20200519-1: ** There are two copies of the header at the beginning of the wal-index. ** When reading, read [0] first then [1]. Writes are in the reverse order. ** Memory barriers are used to prevent the compiler or the hardware from ** reordering the reads and writes. TSAN and similar tools can sometimes ** give false-positive warnings about these accesses because the tools do not ** account for the double-read and the memory barrier. The use of mutexes ** here would be problematic as the memory being accessed is potentially ** shared among multiple processes and not all mutex implementions work ** reliably in that environment. */ aHdr = walIndexHdr(pWal); memcpy(&h1, (void *)&aHdr[0], sizeof(h1)); /* Possible TSAN false-positive */ walShmBarrier(pWal); memcpy(&h2, (void *)&aHdr[1], sizeof(h2)); if( memcmp(&h1, &h2, sizeof(h1))!=0 ){ return 1; /* Dirty read */ } if( h1.isInit==0 ){ |
︙ | ︙ | |||
61869 61870 61871 61872 61873 61874 61875 | return walBeginShmUnreliable(pWal, pChanged); } } assert( pWal->nWiData>0 ); assert( pWal->apWiData[0]!=0 ); pInfo = walCkptInfo(pWal); | | | 61892 61893 61894 61895 61896 61897 61898 61899 61900 61901 61902 61903 61904 61905 61906 | return walBeginShmUnreliable(pWal, pChanged); } } assert( pWal->nWiData>0 ); assert( pWal->apWiData[0]!=0 ); pInfo = walCkptInfo(pWal); if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame #ifdef SQLITE_ENABLE_SNAPSHOT && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0) #endif ){ /* The WAL has been completely backfilled (or it is empty). ** and can be safely ignored. */ |
︙ | ︙ | |||
62036 62037 62038 62039 62040 62041 62042 | if( rc==SQLITE_OK ){ void *pBuf1 = sqlite3_malloc(szPage); void *pBuf2 = sqlite3_malloc(szPage); if( pBuf1==0 || pBuf2==0 ){ rc = SQLITE_NOMEM; }else{ u32 i = pInfo->nBackfillAttempted; | | | 62059 62060 62061 62062 62063 62064 62065 62066 62067 62068 62069 62070 62071 62072 62073 | if( rc==SQLITE_OK ){ void *pBuf1 = sqlite3_malloc(szPage); void *pBuf2 = sqlite3_malloc(szPage); if( pBuf1==0 || pBuf2==0 ){ rc = SQLITE_NOMEM; }else{ u32 i = pInfo->nBackfillAttempted; for(i=pInfo->nBackfillAttempted; i>AtomicLoad(&pInfo->nBackfill); i--){ WalHashLoc sLoc; /* Hash table location */ u32 pgno; /* Page number in db file */ i64 iDbOff; /* Offset of db file entry */ i64 iWalOff; /* Offset of wal file entry */ rc = walHashGet(pWal, walFramePage(i), &sLoc); if( rc!=SQLITE_OK ) break; |
︙ | ︙ | |||
62265 62266 62267 62268 62269 62270 62271 62272 62273 62274 62275 62276 62277 | */ iMinHash = walFramePage(pWal->minFrame); for(iHash=walFramePage(iLast); iHash>=iMinHash; iHash--){ WalHashLoc sLoc; /* Hash table location */ int iKey; /* Hash slot index */ int nCollide; /* Number of hash collisions remaining */ int rc; /* Error code */ rc = walHashGet(pWal, iHash, &sLoc); if( rc!=SQLITE_OK ){ return rc; } nCollide = HASHTABLE_NSLOT; | > | | > | 62288 62289 62290 62291 62292 62293 62294 62295 62296 62297 62298 62299 62300 62301 62302 62303 62304 62305 62306 62307 62308 62309 62310 62311 62312 62313 62314 62315 62316 62317 62318 62319 | */ iMinHash = walFramePage(pWal->minFrame); for(iHash=walFramePage(iLast); iHash>=iMinHash; iHash--){ WalHashLoc sLoc; /* Hash table location */ int iKey; /* Hash slot index */ int nCollide; /* Number of hash collisions remaining */ int rc; /* Error code */ u32 iH; rc = walHashGet(pWal, iHash, &sLoc); if( rc!=SQLITE_OK ){ return rc; } nCollide = HASHTABLE_NSLOT; iKey = walHash(pgno); while( (iH = AtomicLoad(&sLoc.aHash[iKey]))!=0 ){ u32 iFrame = iH + sLoc.iZero; if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH]==pgno ){ assert( iFrame>iRead || CORRUPT_DB ); iRead = iFrame; } if( (nCollide--)==0 ){ return SQLITE_CORRUPT_BKPT; } iKey = walNextHash(iKey); } if( iRead ) break; } #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT /* If expensive assert() statements are available, do a linear search ** of the wal-index file content. Make sure the results agree with the |
︙ | ︙ | |||
79305 79306 79307 79308 79309 79310 79311 79312 79313 79314 79315 79316 79317 79318 79319 79320 79321 79322 79323 79324 79325 79326 79327 79328 79329 79330 79331 79332 79333 79334 79335 79336 | */ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ char *zP4; char *zCom; sqlite3 dummyDb; static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n"; if( pOut==0 ) pOut = stdout; dummyDb.mallocFailed = 1; zP4 = sqlite3VdbeDisplayP4(&dummyDb, pOp); #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS zCom = sqlite3VdbeDisplayComment(0, pOp, zP4); #else zCom = 0; #endif /* NB: The sqlite3OpcodeName() function is implemented by code created ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the ** information from the vdbe.c source text */ fprintf(pOut, zFormat1, pc, sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4 ? zP4 : "", pOp->p5, zCom ? zCom : "" ); fflush(pOut); sqlite3_free(zP4); sqlite3_free(zCom); } #endif /* ** Initialize an array of N Mem element. */ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ | > > | 79330 79331 79332 79333 79334 79335 79336 79337 79338 79339 79340 79341 79342 79343 79344 79345 79346 79347 79348 79349 79350 79351 79352 79353 79354 79355 79356 79357 79358 79359 79360 79361 79362 79363 | */ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ char *zP4; char *zCom; sqlite3 dummyDb; static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n"; if( pOut==0 ) pOut = stdout; sqlite3BeginBenignMalloc(); dummyDb.mallocFailed = 1; zP4 = sqlite3VdbeDisplayP4(&dummyDb, pOp); #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS zCom = sqlite3VdbeDisplayComment(0, pOp, zP4); #else zCom = 0; #endif /* NB: The sqlite3OpcodeName() function is implemented by code created ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the ** information from the vdbe.c source text */ fprintf(pOut, zFormat1, pc, sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4 ? zP4 : "", pOp->p5, zCom ? zCom : "" ); fflush(pOut); sqlite3_free(zP4); sqlite3_free(zCom); sqlite3EndBenignMalloc(); } #endif /* ** Initialize an array of N Mem element. */ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ |
︙ | ︙ | |||
84064 84065 84066 84067 84068 84069 84070 | sqlite3VdbeMemRelease(pVar); pVar->flags = MEM_Null; p->db->errCode = SQLITE_OK; /* If the bit corresponding to this variable in Vdbe.expmask is set, then ** binding a new value to this variable invalidates the current query plan. ** | | | 84091 84092 84093 84094 84095 84096 84097 84098 84099 84100 84101 84102 84103 84104 84105 | sqlite3VdbeMemRelease(pVar); pVar->flags = MEM_Null; p->db->errCode = SQLITE_OK; /* If the bit corresponding to this variable in Vdbe.expmask is set, then ** binding a new value to this variable invalidates the current query plan. ** ** IMPLEMENTATION-OF: R-57496-20354 If the specific value bound to a host ** parameter in the WHERE clause might influence the choice of query plan ** for a statement, then the statement will be automatically recompiled, ** as if there had been a schema change, on the first sqlite3_step() call ** following any change to the bindings of that parameter. */ assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){ |
︙ | ︙ | |||
96363 96364 96365 96366 96367 96368 96369 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file implements virtual-tables for examining the bytecode content ** of a prepared statement. */ | < > | 96390 96391 96392 96393 96394 96395 96396 96397 96398 96399 96400 96401 96402 96403 96404 96405 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file implements virtual-tables for examining the bytecode content ** of a prepared statement. */ /* #include "sqliteInt.h" */ #if defined(SQLITE_ENABLE_BYTECODE_VTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE) /* #include "vdbeInt.h" */ /* An instance of the bytecode() table-valued function. */ typedef struct bytecodevtab bytecodevtab; struct bytecodevtab { sqlite3_vtab base; /* Base class - must be first */ |
︙ | ︙ | |||
96769 96770 96771 96772 96773 96774 96775 96776 96777 96778 96779 96780 96781 96782 | int rc; rc = sqlite3_create_module(db, "bytecode", &bytecodevtabModule, 0); if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "tables_used", &bytecodevtabModule, &db); } return rc; } #endif /* SQLITE_ENABLE_BYTECODE_VTAB */ /************** End of vdbevtab.c ********************************************/ /************** Begin file memjournal.c **************************************/ /* ** 2008 October 7 ** | > > | 96796 96797 96798 96799 96800 96801 96802 96803 96804 96805 96806 96807 96808 96809 96810 96811 | int rc; rc = sqlite3_create_module(db, "bytecode", &bytecodevtabModule, 0); if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "tables_used", &bytecodevtabModule, &db); } return rc; } #elif defined(SQLITE_ENABLE_BYTECODE_VTAB) SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db){ return SQLITE_OK; } #endif /* SQLITE_ENABLE_BYTECODE_VTAB */ /************** End of vdbevtab.c ********************************************/ /************** Begin file memjournal.c **************************************/ /* ** 2008 October 7 ** |
︙ | ︙ | |||
103073 103074 103075 103076 103077 103078 103079 103080 103081 103082 103083 103084 103085 103086 | VdbeCoverage(v); sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target); } setDoNotMergeFlagOnCopy(v); sqlite3VdbeResolveLabel(v, endCoalesce); break; } default: { /* The UNLIKELY() function is a no-op. The result is the value ** of the first argument. */ assert( nFarg==1 || nFarg==2 ); target = sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target); | > > > > > > > | 103102 103103 103104 103105 103106 103107 103108 103109 103110 103111 103112 103113 103114 103115 103116 103117 103118 103119 103120 103121 103122 | VdbeCoverage(v); sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target); } setDoNotMergeFlagOnCopy(v); sqlite3VdbeResolveLabel(v, endCoalesce); break; } case INLINEFUNC_iif: { Expr caseExpr; memset(&caseExpr, 0, sizeof(caseExpr)); caseExpr.op = TK_CASE; caseExpr.x.pList = pFarg; return sqlite3ExprCodeTarget(pParse, &caseExpr, target); } default: { /* The UNLIKELY() function is a no-op. The result is the value ** of the first argument. */ assert( nFarg==1 || nFarg==2 ); target = sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target); |
︙ | ︙ | |||
105495 105496 105497 105498 105499 105500 105501 | /* Get a NULL terminated version of the new table name. */ zName = sqlite3NameFromToken(db, pName); if( !zName ) goto exit_rename_table; /* Check that a table or index named 'zName' does not already exist ** in database iDb. If so, this is an error. */ | | > > > | 105531 105532 105533 105534 105535 105536 105537 105538 105539 105540 105541 105542 105543 105544 105545 105546 105547 105548 | /* Get a NULL terminated version of the new table name. */ zName = sqlite3NameFromToken(db, pName); if( !zName ) goto exit_rename_table; /* Check that a table or index named 'zName' does not already exist ** in database iDb. If so, this is an error. */ if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) || sqlite3IsShadowTableOf(db, pTab, zName) ){ sqlite3ErrorMsg(pParse, "there is already another table or index with this name: %s", zName); goto exit_rename_table; } /* Make sure it is not a system table being altered, or a reserved name ** that the table is being renamed to. |
︙ | ︙ | |||
110242 110243 110244 110245 110246 110247 110248 | #if SQLITE_USER_AUTHENTICATION /* Only the admin user is allowed to know that the sqlite_user table ** exists */ if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){ return 0; } #endif | | | < | > > > > | | > | | < | | | | > > > > > > > > > > > > > > | | 110281 110282 110283 110284 110285 110286 110287 110288 110289 110290 110291 110292 110293 110294 110295 110296 110297 110298 110299 110300 110301 110302 110303 110304 110305 110306 110307 110308 110309 110310 110311 110312 110313 110314 110315 110316 110317 110318 110319 110320 110321 110322 110323 110324 110325 110326 110327 | #if SQLITE_USER_AUTHENTICATION /* Only the admin user is allowed to know that the sqlite_user table ** exists */ if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){ return 0; } #endif if( zDatabase ){ for(i=0; i<db->nDb; i++){ if( sqlite3StrICmp(zDatabase, db->aDb[i].zDbSName)==0 ) break; } if( i>=db->nDb ){ /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ if( sqlite3StrICmp(zDatabase,"main")==0 ){ i = 0; }else{ return 0; } } p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName); if( p==0 && i==1 && sqlite3StrICmp(zName, MASTER_NAME)==0 ){ /* All temp.sqlite_master to be an alias for sqlite_temp_master */ p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, TEMP_MASTER_NAME); } }else{ /* Match against TEMP first */ p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, zName); if( p ) return p; /* The main database is second */ p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, zName); if( p ) return p; /* Attached databases are in order of attachment */ for(i=2; i<db->nDb; i++){ assert( sqlite3SchemaMutexHeld(db, i, 0) ); p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName); if( p ) break; } } return p; } /* ** Locate the in-memory structure that describes a particular database ** table given the name of that table and (optionally) the name of the ** database containing the table. Return NULL if not found. Also leave an ** error message in pParse->zErrMsg. |
︙ | ︙ | |||
112061 112062 112063 112064 112065 112066 112067 112068 112069 112070 112071 112072 112073 112074 112075 112076 112077 112078 | } } assert( pPk->nColumn==j ); assert( pTab->nNVCol<=j ); recomputeColumnsNotIndexed(pPk); } #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Return true if zName is a shadow table name in the current database ** connection. ** ** zName is temporarily modified while this routine is running, but is ** restored to its original value prior to this routine returning. */ SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ char *zTail; /* Pointer to the last "_" in zName */ Table *pTab; /* Table that zName is a shadow of */ | > > > > > > > > > > > > > > > > > > > > > > < < < | < < < > | 112117 112118 112119 112120 112121 112122 112123 112124 112125 112126 112127 112128 112129 112130 112131 112132 112133 112134 112135 112136 112137 112138 112139 112140 112141 112142 112143 112144 112145 112146 112147 112148 112149 112150 112151 112152 112153 112154 112155 112156 112157 112158 112159 112160 112161 112162 112163 112164 112165 112166 112167 112168 112169 112170 112171 112172 112173 112174 | } } assert( pPk->nColumn==j ); assert( pTab->nNVCol<=j ); recomputeColumnsNotIndexed(pPk); } #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Return true if pTab is a virtual table and zName is a shadow table name ** for that virtual table. */ SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3 *db, Table *pTab, const char *zName){ int nName; /* Length of zName */ Module *pMod; /* Module for the virtual table */ if( !IsVirtual(pTab) ) return 0; nName = sqlite3Strlen30(pTab->zName); if( sqlite3_strnicmp(zName, pTab->zName, nName)!=0 ) return 0; if( zName[nName]!='_' ) return 0; pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); if( pMod==0 ) return 0; if( pMod->pModule->iVersion<3 ) return 0; if( pMod->pModule->xShadowName==0 ) return 0; return pMod->pModule->xShadowName(zName+nName+1); } #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Return true if zName is a shadow table name in the current database ** connection. ** ** zName is temporarily modified while this routine is running, but is ** restored to its original value prior to this routine returning. */ SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ char *zTail; /* Pointer to the last "_" in zName */ Table *pTab; /* Table that zName is a shadow of */ zTail = strrchr(zName, '_'); if( zTail==0 ) return 0; *zTail = 0; pTab = sqlite3FindTable(db, zName, 0); *zTail = '_'; if( pTab==0 ) return 0; if( !IsVirtual(pTab) ) return 0; return sqlite3IsShadowTableOf(db, pTab, zName); } #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ #ifdef SQLITE_DEBUG /* ** Mark all nodes of an expression as EP_Immutable, indicating that ** they should not be changed. Expressions attached to a table or ** index definition are tagged this way to help ensure that we do ** not pass them into code generator routines by mistake. |
︙ | ︙ | |||
117778 117779 117780 117781 117782 117783 117784 | } cntExpand++; if( (cntExpand&(cntExpand-1))==0 ){ /* Grow the size of the output buffer only on substitutions ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; | | | 117851 117852 117853 117854 117855 117856 117857 117858 117859 117860 117861 117862 117863 117864 117865 | } cntExpand++; if( (cntExpand&(cntExpand-1))==0 ){ /* Grow the size of the output buffer only on substitutions ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; zOut = sqlite3Realloc(zOut, (int)nOut + (nOut - nStr - 1)); if( zOut==0 ){ sqlite3_result_error_nomem(context); sqlite3_free(zOld); return; } } } |
︙ | ︙ | |||
118475 118476 118477 118478 118479 118480 118481 | #ifndef SQLITE_OMIT_FLOATING_POINT FUNCTION(round, 1, 0, 0, roundFunc ), FUNCTION(round, 2, 0, 0, roundFunc ), #endif FUNCTION(upper, 1, 0, 0, upperFunc ), FUNCTION(lower, 1, 0, 0, lowerFunc ), FUNCTION(hex, 1, 0, 0, hexFunc ), | | | 118548 118549 118550 118551 118552 118553 118554 118555 118556 118557 118558 118559 118560 118561 118562 | #ifndef SQLITE_OMIT_FLOATING_POINT FUNCTION(round, 1, 0, 0, roundFunc ), FUNCTION(round, 2, 0, 0, roundFunc ), #endif FUNCTION(upper, 1, 0, 0, upperFunc ), FUNCTION(lower, 1, 0, 0, lowerFunc ), FUNCTION(hex, 1, 0, 0, hexFunc ), INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ), VFUNCTION(random, 0, 0, 0, randomFunc ), VFUNCTION(randomblob, 1, 0, 0, randomBlob ), FUNCTION(nullif, 2, 0, 1, nullifFunc ), DFUNCTION(sqlite_version, 0, 0, 0, versionFunc ), DFUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ), FUNCTION(sqlite_log, 2, 0, 0, errlogFunc ), FUNCTION(quote, 1, 0, 0, quoteFunc ), |
︙ | ︙ | |||
118515 118516 118517 118518 118519 118520 118521 | LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), #endif #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION FUNCTION(unknown, -1, 0, 0, unknownFunc ), #endif FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), | | > | 118588 118589 118590 118591 118592 118593 118594 118595 118596 118597 118598 118599 118600 118601 118602 118603 | LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), #endif #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION FUNCTION(unknown, -1, 0, 0, unknownFunc ), #endif FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ), INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ), }; #ifndef SQLITE_OMIT_ALTERTABLE sqlite3AlterFunctions(); #endif sqlite3WindowFunctions(); sqlite3RegisterDateTimeFunctions(); sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); |
︙ | ︙ | |||
135568 135569 135570 135571 135572 135573 135574 | need = nCol*2; }else{ need = nCol; } if( p->nData + need > p->nAlloc ){ char **azNew; p->nAlloc = p->nAlloc*2 + need; | | | 135642 135643 135644 135645 135646 135647 135648 135649 135650 135651 135652 135653 135654 135655 135656 | need = nCol*2; }else{ need = nCol; } if( p->nData + need > p->nAlloc ){ char **azNew; p->nAlloc = p->nAlloc*2 + need; azNew = sqlite3Realloc( p->azResult, sizeof(char*)*p->nAlloc ); if( azNew==0 ) goto malloc_failed; p->azResult = azNew; } /* If this is the first row, then generate an extra row containing ** the names of all columns. */ |
︙ | ︙ | |||
135677 135678 135679 135680 135681 135682 135683 | sqlite3_free(res.zErrMsg); if( rc!=SQLITE_OK ){ sqlite3_free_table(&res.azResult[1]); return rc; } if( res.nAlloc>res.nData ){ char **azNew; | | | 135751 135752 135753 135754 135755 135756 135757 135758 135759 135760 135761 135762 135763 135764 135765 | sqlite3_free(res.zErrMsg); if( rc!=SQLITE_OK ){ sqlite3_free_table(&res.azResult[1]); return rc; } if( res.nAlloc>res.nData ){ char **azNew; azNew = sqlite3Realloc( res.azResult, sizeof(char*)*res.nData ); if( azNew==0 ){ sqlite3_free_table(&res.azResult[1]); db->errCode = SQLITE_NOMEM; return SQLITE_NOMEM_BKPT; } res.azResult = azNew; } |
︙ | ︙ | |||
136967 136968 136969 136970 136971 136972 136973 | ** into the sqlite_master table.) ** ** Therefore, the P4 parameter is only required if the default value for ** the column is a literal number, string or null. The sqlite3ValueFromExpr() ** function is capable of transforming these types of expressions into ** sqlite3_value objects. ** | > > | < < | | | 137041 137042 137043 137044 137045 137046 137047 137048 137049 137050 137051 137052 137053 137054 137055 137056 137057 137058 137059 137060 137061 137062 137063 137064 137065 137066 137067 137068 137069 137070 137071 137072 137073 137074 137075 | ** into the sqlite_master table.) ** ** Therefore, the P4 parameter is only required if the default value for ** the column is a literal number, string or null. The sqlite3ValueFromExpr() ** function is capable of transforming these types of expressions into ** sqlite3_value objects. ** ** If column as REAL affinity and the table is an ordinary b-tree table ** (not a virtual table) then the value might have been stored as an ** integer. In that case, add an OP_RealAffinity opcode to make sure ** it has been converted into REAL. */ SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ assert( pTab!=0 ); if( !pTab->pSelect ){ sqlite3_value *pValue = 0; u8 enc = ENC(sqlite3VdbeDb(v)); Column *pCol = &pTab->aCol[i]; VdbeComment((v, "%s.%s", pTab->zName, pCol->zName)); assert( i<pTab->nCol ); sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, pCol->affinity, &pValue); if( pValue ){ sqlite3VdbeAppendP4(v, pValue, P4_MEM); } } #ifndef SQLITE_OMIT_FLOATING_POINT if( pTab->aCol[i].affinity==SQLITE_AFF_REAL && !IsVirtual(pTab) ){ sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); } #endif } /* ** Check to see if column iCol of index pIdx references any of the |
︙ | ︙ | |||
139836 139837 139838 139839 139840 139841 139842 | Table **apVtabLock; assert( IsVirtual(pTab) ); for(i=0; i<pToplevel->nVtabLock; i++){ if( pTab==pToplevel->apVtabLock[i] ) return; } n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]); | | | 139910 139911 139912 139913 139914 139915 139916 139917 139918 139919 139920 139921 139922 139923 139924 | Table **apVtabLock; assert( IsVirtual(pTab) ); for(i=0; i<pToplevel->nVtabLock; i++){ if( pTab==pToplevel->apVtabLock[i] ) return; } n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]); apVtabLock = sqlite3Realloc(pToplevel->apVtabLock, n); if( apVtabLock ){ pToplevel->apVtabLock = apVtabLock; pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab; }else{ sqlite3OomFault(pToplevel->db); } } |
︙ | ︙ | |||
151128 151129 151130 151131 151132 151133 151134 | ExprList *pAppend, /* List of values to append. Might be NULL */ int bIntToNull ){ if( pAppend ){ int i; int nInit = pList ? pList->nExpr : 0; for(i=0; i<pAppend->nExpr; i++){ | < | > > > > > > | | | > | 151202 151203 151204 151205 151206 151207 151208 151209 151210 151211 151212 151213 151214 151215 151216 151217 151218 151219 151220 151221 151222 151223 151224 151225 151226 151227 151228 | ExprList *pAppend, /* List of values to append. Might be NULL */ int bIntToNull ){ if( pAppend ){ int i; int nInit = pList ? pList->nExpr : 0; for(i=0; i<pAppend->nExpr; i++){ Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0); assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) ); if( bIntToNull && pDup ){ int iDummy; Expr *pSub; for(pSub=pDup; ExprHasProperty(pSub, EP_Skip); pSub=pSub->pLeft){ assert( pSub ); } if( sqlite3ExprIsInteger(pSub, &iDummy) ){ pSub->op = TK_NULL; pSub->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse); pSub->u.zToken = 0; } } pList = sqlite3ExprListAppend(pParse, pList, pDup); if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags; } } return pList; } |
︙ | ︙ | |||
160320 160321 160322 160323 160324 160325 160326 160327 160328 160329 160330 160331 160332 160333 | if( rc==SQLITE_OK ){ rc = sqlite3MemdbInit(); } #endif if( rc==SQLITE_OK ){ sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); sqlite3GlobalConfig.isInit = 1; #ifdef SQLITE_EXTRA_INIT bRunExtraInit = 1; #endif } sqlite3GlobalConfig.inProgress = 0; } | > | 160400 160401 160402 160403 160404 160405 160406 160407 160408 160409 160410 160411 160412 160413 160414 | if( rc==SQLITE_OK ){ rc = sqlite3MemdbInit(); } #endif if( rc==SQLITE_OK ){ sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); sqlite3MemoryBarrier(); sqlite3GlobalConfig.isInit = 1; #ifdef SQLITE_EXTRA_INIT bRunExtraInit = 1; #endif } sqlite3GlobalConfig.inProgress = 0; } |
︙ | ︙ | |||
163268 163269 163270 163271 163272 163273 163274 | assert( SQLITE_OPEN_READONLY == 0x01 ); assert( SQLITE_OPEN_READWRITE == 0x02 ); assert( SQLITE_OPEN_CREATE == 0x04 ); testcase( (1<<(flags&7))==0x02 ); /* READONLY */ testcase( (1<<(flags&7))==0x04 ); /* READWRITE */ testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */ if( ((1<<(flags&7)) & 0x46)==0 ){ | | | 163349 163350 163351 163352 163353 163354 163355 163356 163357 163358 163359 163360 163361 163362 163363 | assert( SQLITE_OPEN_READONLY == 0x01 ); assert( SQLITE_OPEN_READWRITE == 0x02 ); assert( SQLITE_OPEN_CREATE == 0x04 ); testcase( (1<<(flags&7))==0x02 ); /* READONLY */ testcase( (1<<(flags&7))==0x04 ); /* READWRITE */ testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */ if( ((1<<(flags&7)) & 0x46)==0 ){ rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */ }else{ rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg); } if( rc!=SQLITE_OK ){ if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg); sqlite3_free(zErrMsg); |
︙ | ︙ | |||
171192 171193 171194 171195 171196 171197 171198 171199 171200 171201 171202 171203 171204 171205 | if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){ Fts3Doclist *pDl = &pLeft->pPhrase->doclist; while( *pRc==SQLITE_OK && pLeft->bEof==0 ){ memset(pDl->pList, 0, pDl->nList); fts3EvalNextRow(pCsr, pLeft, pRc); } } } } break; } case FTSQUERY_OR: { Fts3Expr *pLeft = pExpr->pLeft; | > | 171273 171274 171275 171276 171277 171278 171279 171280 171281 171282 171283 171284 171285 171286 171287 | if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){ Fts3Doclist *pDl = &pLeft->pPhrase->doclist; while( *pRc==SQLITE_OK && pLeft->bEof==0 ){ memset(pDl->pList, 0, pDl->nList); fts3EvalNextRow(pCsr, pLeft, pRc); } } pRight->bEof = pLeft->bEof = 1; } } break; } case FTSQUERY_OR: { Fts3Expr *pLeft = pExpr->pLeft; |
︙ | ︙ | |||
182737 182738 182739 182740 182741 182742 182743 | assert( p->flag==FTS3_MATCHINFO_LHITS_BM || p->flag==FTS3_MATCHINFO_LHITS ); if( p->flag==FTS3_MATCHINFO_LHITS ){ iStart = pExpr->iPhrase * p->nCol; }else{ iStart = pExpr->iPhrase * ((p->nCol + 31) / 32); } | | | 182819 182820 182821 182822 182823 182824 182825 182826 182827 182828 182829 182830 182831 182832 182833 | assert( p->flag==FTS3_MATCHINFO_LHITS_BM || p->flag==FTS3_MATCHINFO_LHITS ); if( p->flag==FTS3_MATCHINFO_LHITS ){ iStart = pExpr->iPhrase * p->nCol; }else{ iStart = pExpr->iPhrase * ((p->nCol + 31) / 32); } if( pIter ) while( 1 ){ int nHit = fts3ColumnlistCount(&pIter); if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){ if( p->flag==FTS3_MATCHINFO_LHITS ){ p->aMatchinfo[iStart + iCol] = (u32)nHit; }else if( nHit ){ p->aMatchinfo[iStart + (iCol+1)/32] |= (1 << (iCol&0x1F)); } |
︙ | ︙ | |||
184651 184652 184653 184654 184655 184656 184657 184658 184659 184660 184661 184662 184663 184664 | p->nAlloc = nTotal; return SQLITE_OK; } /* Append N bytes from zIn onto the end of the JsonString string. */ static void jsonAppendRaw(JsonString *p, const char *zIn, u32 N){ if( (N+p->nUsed >= p->nAlloc) && jsonGrow(p,N)!=0 ) return; memcpy(p->zBuf+p->nUsed, zIn, N); p->nUsed += N; } /* Append formatted text (not to exceed N bytes) to the JsonString. */ | > | 184733 184734 184735 184736 184737 184738 184739 184740 184741 184742 184743 184744 184745 184746 184747 | p->nAlloc = nTotal; return SQLITE_OK; } /* Append N bytes from zIn onto the end of the JsonString string. */ static void jsonAppendRaw(JsonString *p, const char *zIn, u32 N){ if( N==0 ) return; if( (N+p->nUsed >= p->nAlloc) && jsonGrow(p,N)!=0 ) return; memcpy(p->zBuf+p->nUsed, zIn, N); p->nUsed += N; } /* Append formatted text (not to exceed N bytes) to the JsonString. */ |
︙ | ︙ | |||
224662 224663 224664 224665 224666 224667 224668 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); | | | 224745 224746 224747 224748 224749 224750 224751 224752 224753 224754 224755 224756 224757 224758 224759 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); sqlite3_result_text(pCtx, "fts5: 2020-05-19 15:51:10 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad40bde", -1, SQLITE_TRANSIENT); } /* ** Return true if zName is the extension on one of the shadow tables used ** by this module. */ static int fts5ShadowName(const char *zName){ |
︙ | ︙ | |||
229445 229446 229447 229448 229449 229450 229451 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 229528 229529 229530 229531 229532 229533 229534 229535 229536 229537 229538 229539 229540 229541 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ #if __LINE__!=229535 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2020-05-19 15:51:10 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad4alt2" #endif /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ |
Changes to src/sqlite3.h.
︙ | ︙ | |||
121 122 123 124 125 126 127 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.32.0" #define SQLITE_VERSION_NUMBER 3032000 | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.32.0" #define SQLITE_VERSION_NUMBER 3032000 #define SQLITE_SOURCE_ID "2020-05-19 15:51:10 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad40bde" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
5491 5492 5493 5494 5495 5496 5497 | ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the | | | 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 | ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the ** value of N in any subsequent call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ Within the xFinal callback, it is customary to set ** N=0 in calls to sqlite3_aggregate_context(C,N) so that no ** pointless memory allocations occur. ** ** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. |
︙ | ︙ |
Changes to src/th_main.c.
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | int *argl ){ if( argc!=3 ){ return Th_WrongNumArgs(interp, "unversioned content FILENAME"); } if( Th_IsRepositoryOpen() ){ Blob content; | | | 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | int *argl ){ if( argc!=3 ){ return Th_WrongNumArgs(interp, "unversioned content FILENAME"); } if( Th_IsRepositoryOpen() ){ Blob content; if( unversioned_content(argv[2], &content)!=0 ){ Th_SetResult(interp, blob_str(&content), blob_size(&content)); blob_reset(&content); return TH_OK; }else{ return TH_ERROR; } }else{ |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 | }else if( fossil_stricmp(zMatchStyle, "like")==0 ){ matchStyle = MS_LIKE; }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){ matchStyle = MS_REGEXP; }else{ /* For exact maching, inhibit links to the selected tag. */ zThisTag = zTagName; } /* Display a checkbox to enable/disable display of related check-ins. */ if( advancedMenu ){ style_submenu_checkbox("rel", "Related", 0, 0); } | > | 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | }else if( fossil_stricmp(zMatchStyle, "like")==0 ){ matchStyle = MS_LIKE; }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){ matchStyle = MS_REGEXP; }else{ /* For exact maching, inhibit links to the selected tag. */ zThisTag = zTagName; Th_Store("current_checkin", zTagName); } /* Display a checkbox to enable/disable display of related check-ins. */ if( advancedMenu ){ style_submenu_checkbox("rel", "Related", 0, 0); } |
︙ | ︙ | |||
2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 | if( zTagSql ){ db_multi_exec( "CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);" "INSERT OR IGNORE INTO selected_nodes" " SELECT tagxref.rid FROM tagxref NATURAL JOIN tag" " WHERE %s AND tagtype>0", zTagSql/*safe-for-%s*/ ); if( !related ){ blob_append_sql(&cond, " AND blob.rid IN selected_nodes"); }else{ db_multi_exec( "CREATE TEMP TABLE related_nodes(rid INTEGER PRIMARY KEY);" "INSERT INTO related_nodes SELECT rid FROM selected_nodes;" ); | > > > > > > > | 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 | if( zTagSql ){ db_multi_exec( "CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);" "INSERT OR IGNORE INTO selected_nodes" " SELECT tagxref.rid FROM tagxref NATURAL JOIN tag" " WHERE %s AND tagtype>0", zTagSql/*safe-for-%s*/ ); if( zMark ){ /* If the t=release option is used with m=UUID, then also ** include the UUID check-in in the display list */ int ridMark = name_to_rid(zMark); db_multi_exec( "INSERT OR IGNORE INTO selected_nodes(rid) VALUES(%d)", ridMark); } if( !related ){ blob_append_sql(&cond, " AND blob.rid IN selected_nodes"); }else{ db_multi_exec( "CREATE TEMP TABLE related_nodes(rid INTEGER PRIMARY KEY);" "INSERT INTO related_nodes SELECT rid FROM selected_nodes;" ); |
︙ | ︙ | |||
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 | }else{ if( related ){ blob_appendf(&desc, " related to tags matching %h", zMatchDesc); }else{ blob_appendf(&desc, " with tags matching %h", zMatchDesc); } } tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } addFileGlobDescription(zChng, &desc); if( rAfter>0.0 ){ if( rBefore>0.0 ){ blob_appendf(&desc, " occurring between %h and %h.<br />", zAfter, zBefore); | > > > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 | }else{ if( related ){ blob_appendf(&desc, " related to tags matching %h", zMatchDesc); }else{ blob_appendf(&desc, " with tags matching %h", zMatchDesc); } } if( zMark ){ blob_appendf(&desc," plus check-in \"%h\"", zMark); } tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } addFileGlobDescription(zChng, &desc); if( rAfter>0.0 ){ if( rBefore>0.0 ){ blob_appendf(&desc, " occurring between %h and %h.<br />", zAfter, zBefore); |
︙ | ︙ |
Changes to src/unversioned.c.
︙ | ︙ | |||
83 84 85 86 87 88 89 | } return zHash; } /* ** Initialize pContent to be the content of an unversioned file zName. ** | | > > | | > | > > > > > > > > > > > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | } return zHash; } /* ** Initialize pContent to be the content of an unversioned file zName. ** ** Return 0 on failures. ** Return 1 if the file is found by name. ** Return 2 if the file is found by hash. */ int unversioned_content(const char *zName, Blob *pContent){ Stmt q; int rc = 0; blob_init(pContent, 0, 0); db_prepare(&q, "SELECT encoding, content FROM unversioned WHERE name=%Q", zName); if( db_step(&q)==SQLITE_ROW ){ db_column_blob(&q, 1, pContent); if( db_column_int(&q, 0)==1 ){ blob_uncompress(pContent, pContent); } rc = 1; } db_finalize(&q); if( rc==0 && validate16(zName,-1) ){ db_prepare(&q, "SELECT encoding, content FROM unversioned WHERE hash=%Q", zName); if( db_step(&q)==SQLITE_ROW ){ db_column_blob(&q, 1, pContent); if( db_column_int(&q, 0)==1 ){ blob_uncompress(pContent, pContent); } rc = 2; } db_finalize(&q); } return rc; } /* ** Write unversioned content into the database. */ static void unversioned_write( |
︙ | ︙ | |||
326 327 328 329 330 331 332 | db_end_transaction(0); }else if( memcmp(zCmd, "cat", nCmd)==0 ){ int i; verify_all_options(); db_begin_transaction(); for(i=3; i<g.argc; i++){ Blob content; | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | db_end_transaction(0); }else if( memcmp(zCmd, "cat", nCmd)==0 ){ int i; verify_all_options(); db_begin_transaction(); for(i=3; i<g.argc; i++){ Blob content; if( unversioned_content(g.argv[i], &content)!=0 ){ blob_write_to_file(&content, "-"); } blob_reset(&content); } db_end_transaction(0); }else if( memcmp(zCmd, "edit", nCmd)==0 ){ const char *zEditor; /* Name of the text-editor command */ |
︙ | ︙ | |||
350 351 352 353 354 355 356 | if( zEditor==0 ){ fossil_fatal("no text editor - set the VISUAL env variable"); } zTFile = fossil_temp_filename(); if( zTFile==0 ) fossil_fatal("cannot find a temporary filename"); db_begin_transaction(); content_rcvid_init("#!fossil unversioned edit"); | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | if( zEditor==0 ){ fossil_fatal("no text editor - set the VISUAL env variable"); } zTFile = fossil_temp_filename(); if( zTFile==0 ) fossil_fatal("cannot find a temporary filename"); db_begin_transaction(); content_rcvid_init("#!fossil unversioned edit"); if( unversioned_content(zUVFile, &content)==0 ){ fossil_fatal("no such uv-file: %Q", zUVFile); } if( looks_like_binary(&content) ){ fossil_fatal("cannot edit binary content"); } #if defined(_WIN32) || defined(__CYGWIN__) blob_add_cr(&content); |
︙ | ︙ | |||
379 380 381 382 383 384 385 | unversioned_write(zUVFile, &content, mtime); db_end_transaction(0); blob_reset(&content); }else if( memcmp(zCmd, "export", nCmd)==0 ){ Blob content; verify_all_options(); if( g.argc!=5 ) usage("export UVFILE OUTPUT"); | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | unversioned_write(zUVFile, &content, mtime); db_end_transaction(0); blob_reset(&content); }else if( memcmp(zCmd, "export", nCmd)==0 ){ Blob content; verify_all_options(); if( g.argc!=5 ) usage("export UVFILE OUTPUT"); if( unversioned_content(g.argv[3], &content)==0 ){ fossil_fatal("no such uv-file: %Q", g.argv[3]); } blob_write_to_file(&content, g.argv[4]); blob_reset(&content); }else if( memcmp(zCmd, "hash", nCmd)==0 ){ /* undocumented */ /* Show the hash value used during uv sync */ int debugFlag = find_option("debug",0,0)!=0; |
︙ | ︙ |
Changes to www/cgi.wiki.
︙ | ︙ | |||
12 13 14 15 16 17 18 | A [./server/|separate document] talks about all of the many different methods for setting up a Fossil server, one of which is [./server/any/cgi.md | as a CGI script]. CGI is the technique that the three [./selfhost.wiki|self-hosting Fossil repositories] all use. Setting up a Fossil server using CGI is mostly about writing a short script (usually just 2 lines line) in the cgi-bin folder of an ordinary | | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | A [./server/|separate document] talks about all of the many different methods for setting up a Fossil server, one of which is [./server/any/cgi.md | as a CGI script]. CGI is the technique that the three [./selfhost.wiki|self-hosting Fossil repositories] all use. Setting up a Fossil server using CGI is mostly about writing a short script (usually just 2 lines line) in the cgi-bin folder of an ordinary web-server. But there are a lot of extra options that can be added to this script, to customize the configuration. This article describes those options. <h1>CGI Script Options</h1> The CGI script used to launch a Fossil server will usually look something like this: |
︙ | ︙ |
Changes to www/index.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <title>Home</title> <h3>What Is Fossil?</h3> <div style='width:200px;float:right;border:2px solid #446979;padding:10px;margin:0px 10px;'> <ul> <li> [/uv/download.html | Download] <li> [./quickstart.wiki | Quick Start] <li> [./build.wiki | Install] <li> [https://fossil-scm.org/forum | Support/Forum ] <li> [./hints.wiki | Tips & Hints] <li> [./changes.wiki | Change Log] <li> [../COPYRIGHT-BSD2.txt | License] | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <title>Home</title> <h3>What Is Fossil?</h3> <div style='width:200px;float:right;border:2px solid #446979;padding:10px;margin:0px 10px;'> <ul> <li> [/uv/download.html | Download] <li> [./quickstart.wiki | Quick Start] <li> [./build.wiki | Install] <li> [https://fossil-scm.org/forum | Support/Forum ] <li> [./hints.wiki | Tips & Hints] <li> [./changes.wiki | Change Log] <li> [../COPYRIGHT-BSD2.txt | License] <li> [./userlinks.wiki | User Links] <li> [./hacker-howto.wiki | Hacker How-To] <li> [./fossil-v-git.wiki | Fossil vs. Git] <li> [./permutedindex.html | Documentation Index] </ul> <img src="fossil3.gif" align="center"> </div> |
︙ | ︙ |