Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge updates from trunk. |
|---|---|
| Timelines: | family | ancestors | descendants | both | mvAndRmFiles |
| Files: | files | file ages | folders |
| SHA1: |
78829b7089ac7a065514382c1c75d3e0 |
| User & Date: | mistachkin 2015-03-23 01:29:22.511 |
Context
|
2015-03-23
| ||
| 01:50 | Update and improve command help for 'mv', 'rm', et al. check-in: 27702f3cc9 user: mistachkin tags: mvAndRmFiles | |
| 01:29 | Merge updates from trunk. check-in: 78829b7089 user: mistachkin tags: mvAndRmFiles | |
| 00:44 | Add tests for the TH1 docs feature. check-in: 71536a2851 user: mistachkin tags: trunk | |
|
2015-03-15
| ||
| 03:49 | Update command help for mv/rm to better reflect the new functionality. check-in: 7b54a4e839 user: mistachkin tags: mvAndRmFiles | |
Changes
Changes to Dockerfile.
1 2 3 4 5 6 | ### # Dockerfile for Fossil ### FROM fedora:21 ### Now install some additional parts we will need for the build | | > > | | < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
###
# Dockerfile for Fossil
###
FROM fedora:21
### Now install some additional parts we will need for the build
RUN yum update -y && yum install -y gcc make zlib-devel openssl-devel tar && yum clean all && groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil
### If you want to build "release", change the next line accordingly.
ENV FOSSIL_INSTALL_VERSION trunk
RUN curl "http://core.tcl.tk/tcl/tarball/tcl-src.tar.gz?name=tcl-src&uuid=release" | tar zx
RUN cd tcl-src/unix && ./configure --prefix=/usr --disable-shared --disable-threads --disable-load && make && make install
RUN curl "http://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx
RUN cd fossil-src && ./configure --disable-lineedit --disable-fusefs --json --with-th1-docs --with-th1-hooks --with-tcl
RUN cd fossil-src && make && strip fossil && cp fossil /usr/bin && cd .. && rm -rf fossil-src && chmod a+rx /usr/bin/fossil && mkdir -p /opt/fossil && chown fossil:fossil /opt/fossil
### Build is done, remove modules no longer needed
RUN yum remove -y gcc make zlib-devel openssl-devel tar && yum clean all
USER fossil
ENV HOME /opt/fossil
EXPOSE 8080
CMD ["/usr/bin/fossil", "server", "--create", "--user", "admin", "/opt/fossil/repository.fossil"]
|
Changes to skins/blitz/css.txt.
| ︙ | ︙ | |||
462 463 464 465 466 467 468 |
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
font-size: 0.75em;
font-weight: 400;
color: #ccc;
}
pre, code {
| | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
font-size: 0.75em;
font-weight: 400;
color: #ccc;
}
pre, code {
font-size: 1.2rem;
}
body {
font-size: 1.4em; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.5;
font-weight: 400;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
| ︙ | ︙ | |||
597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
textarea {
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}
input[type="email"]:focus,
input[type="number"]:focus,
| > | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
textarea {
height: inherit;
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}
input[type="email"]:focus,
input[type="number"]:focus,
|
| ︙ | ︙ | |||
855 856 857 858 859 860 861 |
padding: 0;
}
.mainmenu li {
outline: 0;
display: block;
float: left;
| < | | > | | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 |
padding: 0;
}
.mainmenu li {
outline: 0;
display: block;
float: left;
margin: 0;
}
.mainmenu li.active {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEQAACxEBf2RfkQAAAAd0SU1FB90FDxEXAZ2XRzAAAABJSURBVCjPY2CgBzhz5sx/QmoYiTXAxMSEkWRDsLkAl0GMpHoBm0EoAlu3bmUQFxcnGAboBjEhc4gxAJtLGUmJBVwuYiTXAGSDAIx5IBObnuVxAAAAAElFTkSuQmCC);
background-repeat: no-repeat;
background-position: center bottom;
}
.mainmenu li a {
color: #3b5c6b;
display: block;
padding: 10px 15px;
}
.mainmenu li.active a {
font-weight: bold;
}
.mainmenu li:hover {
background-color: #eee;
}
/* Submenu
* Displayed in the middle div. Contains page-specific form controls.
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
.submenu {
padding: 10px 0px;
border-bottom: 1px solid #ddd;
}
.submenu input, .submenu select {
margin: 0 0 0 5px;
}
.submenu a {
color: #3b5c6b;
padding: 5px 15px;
text-decoration: none;
border: 1px solid transparent;
|
| ︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 |
div.timelineDate {
font-weight: bold;
white-space: nowrap;
}
a.timelineHistLink {
| | < | < | | | | | | > > > > > | 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 |
div.timelineDate {
font-weight: bold;
white-space: nowrap;
}
a.timelineHistLink {
text-transform: lowercase;
}
span.timelineComment {
padding: 0px 5px;
}
/* Login/Loguot
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
table.login_out {
}
table.login_out .login_out_label {
font-weight: 700;
text-align: right;
}
table.login_out td {
border: 0;
}
/* Diff displays
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
pre.udiff, table.sbsdiffcols {
width: 100%;
overflow: auto;
border: 1px solid #ccc;
padding: 5px;
font-size: 1rem;
}
pre.udiff:focus, table.sbsdiffcols:focus {
outline: none;
}
/* Ticket Reports
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
table.report {
width: 100%;
|
| ︙ | ︙ |
Changes to skins/blitz_no_logo/css.txt.
| ︙ | ︙ | |||
462 463 464 465 466 467 468 |
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
font-size: 0.75em;
font-weight: 400;
color: #ccc;
}
pre, code {
| | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
font-size: 0.75em;
font-weight: 400;
color: #ccc;
}
pre, code {
font-size: 1.2rem;
}
body {
font-size: 1.4em; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.5;
font-weight: 400;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
| ︙ | ︙ | |||
597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
textarea {
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}
input[type="email"]:focus,
input[type="number"]:focus,
| > | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
textarea {
height: inherit;
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}
input[type="email"]:focus,
input[type="number"]:focus,
|
| ︙ | ︙ | |||
855 856 857 858 859 860 861 |
padding: 0;
}
.mainmenu li {
outline: 0;
display: block;
float: left;
| < | | > | | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 |
padding: 0;
}
.mainmenu li {
outline: 0;
display: block;
float: left;
margin: 0;
}
.mainmenu li.active {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEQAACxEBf2RfkQAAAAd0SU1FB90FDxEXAZ2XRzAAAABJSURBVCjPY2CgBzhz5sx/QmoYiTXAxMSEkWRDsLkAl0GMpHoBm0EoAlu3bmUQFxcnGAboBjEhc4gxAJtLGUmJBVwuYiTXAGSDAIx5IBObnuVxAAAAAElFTkSuQmCC);
background-repeat: no-repeat;
background-position: center bottom;
}
.mainmenu li a {
color: #3b5c6b;
display: block;
padding: 10px 15px;
}
.mainmenu li.active a {
font-weight: bold;
}
.mainmenu li:hover {
background-color: #eee;
}
/* Submenu
* Displayed in the middle div. Contains page-specific form controls.
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
.submenu {
padding: 10px 0px;
border-bottom: 1px solid #ddd;
}
.submenu input, .submenu select {
margin: 0 0 0 5px;
}
.submenu a {
color: #3b5c6b;
padding: 5px 15px;
text-decoration: none;
border: 1px solid transparent;
|
| ︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 |
div.timelineDate {
font-weight: bold;
white-space: nowrap;
}
a.timelineHistLink {
| | < | < | | | | | > > > | > > | 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 |
div.timelineDate {
font-weight: bold;
white-space: nowrap;
}
a.timelineHistLink {
text-transform: lowercase;
}
span.timelineComment {
padding: 0px 5px;
}
/* Login/Loguot
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
table.login_out {
}
table.login_out .login_out_label {
font-weight: 700;
text-align: right;
}
table.login_out td {
border: 0;
}
/* Diff displays
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
pre.udiff, table.sbsdiffcols {
width: 100%;
overflow: auto;
border: 1px solid #ccc;
padding: 0px 5px;
font-size: 1rem;
}
pre.udiff:focus, table.sbsdiffcols:focus {
outline: none;
}
/* Ticket Reports
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */
table.report {
width: 100%;
|
| ︙ | ︙ |
Changes to skins/eagle/header.txt.
| ︙ | ︙ | |||
68 69 70 71 72 73 74 |
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
| < < < < < | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
</a>
</div>
<div class="title">$<title></div>
<div class="status"><nobr><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
|
| ︙ | ︙ |
Changes to skins/enhanced1/header.txt.
| ︙ | ︙ | |||
68 69 70 71 72 73 74 |
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
| < < < < < | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
</a>
</div>
<div class="title">$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
|
| ︙ | ︙ |
Changes to src/add.c.
| ︙ | ︙ | |||
304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
db_must_be_within_tree();
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
vid = db_lget_int("checkout",0);
db_begin_transaction();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
filename_collation());
pClean = glob_create(zCleanFlag);
pIgnore = glob_create(zIgnoreFlag);
nRoot = strlen(g.zLocalRoot);
| > | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
db_must_be_within_tree();
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
db_begin_transaction();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
filename_collation());
pClean = glob_create(zCleanFlag);
pIgnore = glob_create(zIgnoreFlag);
nRoot = strlen(g.zLocalRoot);
|
| ︙ | ︙ | |||
644 645 646 647 648 649 650 651 652 653 654 655 656 657 |
db_must_be_within_tree();
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
vid = db_lget_int("checkout",0);
db_begin_transaction();
/* step 1:
** Populate the temp table "sfile" with the names of all unmanaged
** files currently in the check-out, except for files that match the
** --ignore or ignore-glob patterns and dot-files. Then add all of
| > | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
db_must_be_within_tree();
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
db_begin_transaction();
/* step 1:
** Populate the temp table "sfile" with the names of all unmanaged
** files currently in the check-out, except for files that match the
** --ignore or ignore-glob patterns and dot-files. Then add all of
|
| ︙ | ︙ |
Changes to src/cache.c.
| ︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | } sqlite3_finalize(pStmt); cache_read_done: sqlite3_exec(db, "COMMIT", 0, 0, 0); sqlite3_close(db); return rc; } /* ** COMMAND: cache* ** Usage: %fossil cache SUBCOMMAND ** ** Manage the cache used for potentially expensive web pages such as ** /zip and /tarball. SUBCOMMAND an be: | > > > > > > > > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
}
sqlite3_finalize(pStmt);
cache_read_done:
sqlite3_exec(db, "COMMIT", 0, 0, 0);
sqlite3_close(db);
return rc;
}
/*
** Create a cache database for the current repository if no such
** database already exists.
*/
void cache_initialize(void){
sqlite3_close(cacheOpen(1));
}
/*
** COMMAND: cache*
** Usage: %fossil cache SUBCOMMAND
**
** Manage the cache used for potentially expensive web pages such as
** /zip and /tarball. SUBCOMMAND an be:
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
Blob rewrittenPathname;
const char *zPathname, *zDisplayName;
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
db_must_be_within_tree();
cwdRelative = determine_cwd_relative_option();
/* We should be done with options.. */
verify_all_options();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
pIgnore = glob_create(zIgnoreFlag);
| > > | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
Blob rewrittenPathname;
const char *zPathname, *zDisplayName;
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
db_must_be_within_tree();
cwdRelative = determine_cwd_relative_option();
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
/* We should be done with options.. */
verify_all_options();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
pIgnore = glob_create(zIgnoreFlag);
|
| ︙ | ︙ | |||
705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
}
if( zKeepFlag==0 ){
zKeepFlag = db_get("keep-glob", 0);
}
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
verify_all_options();
pIgnore = glob_create(zIgnoreFlag);
pKeep = glob_create(zKeepFlag);
pClean = glob_create(zCleanFlag);
nRoot = (int)strlen(g.zLocalRoot);
g.allowSymlinks = 1; /* Find symlinks too */
if( !dirsOnlyFlag ){
| > | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
}
if( zKeepFlag==0 ){
zKeepFlag = db_get("keep-glob", 0);
}
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
verify_all_options();
pIgnore = glob_create(zIgnoreFlag);
pKeep = glob_create(zKeepFlag);
pClean = glob_create(zCleanFlag);
nRoot = (int)strlen(g.zLocalRoot);
g.allowSymlinks = 1; /* Find symlinks too */
if( !dirsOnlyFlag ){
|
| ︙ | ︙ |
Changes to src/clone.c.
| ︙ | ︙ | |||
162 163 164 165 166 167 168 |
}
fossil_print("Repository cloned into %s\n", g.argv[3]);
}else{
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_begin_transaction();
db_record_repository_filename(g.argv[3]);
| | > | 162 163 164 165 166 167 168 169 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 |
}
fossil_print("Repository cloned into %s\n", g.argv[3]);
}else{
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_begin_transaction();
db_record_repository_filename(g.argv[3]);
db_initial_setup(0, 0, zDefaultUser);
user_select();
db_set("content-schema", CONTENT_SCHEMA, 0);
db_set("aux-schema", AUX_SCHEMA_MAX, 0);
db_set("rebuilt", get_version(), 0);
remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
url_remember();
if( g.zSSLIdentity!=0 ){
/* If the --ssl-identity option was specified, store it as a setting */
Blob fn;
blob_zero(&fn);
file_canonical_name(g.zSSLIdentity, &fn, 0);
db_set("ssl-identity", blob_str(&fn), 0);
blob_reset(&fn);
}
db_multi_exec(
"REPLACE INTO config(name,value,mtime)"
" VALUES('server-code', lower(hex(randomblob(20))), now());"
"DELETE FROM config WHERE name='project-code';"
);
url_enable_proxy(0);
clone_ssh_db_set_options();
url_get_password_if_needed();
g.xlinkClusterOnly = 1;
nErr = client_sync(syncFlags,CONFIGSET_ALL,0);
g.xlinkClusterOnly = 0;
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
{ "adunit", CONFIGSET_SKIN },
{ "adunit-omit-if-admin", CONFIGSET_SKIN },
{ "adunit-omit-if-user", CONFIGSET_SKIN },
{ "white-foreground", CONFIGSET_SKIN },
#ifdef FOSSIL_ENABLE_TH1_DOCS
{ "th1-docs", CONFIGSET_TH1 },
#endif
#ifdef FOSSIL_ENABLE_TH1_HOOKS
{ "th1-hooks", CONFIGSET_TH1 },
#endif
{ "th1-setup", CONFIGSET_TH1 },
| > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
{ "adunit", CONFIGSET_SKIN },
{ "adunit-omit-if-admin", CONFIGSET_SKIN },
{ "adunit-omit-if-user", CONFIGSET_SKIN },
{ "white-foreground", CONFIGSET_SKIN },
#ifdef FOSSIL_ENABLE_TH1_DOCS
{ "th1-docs", CONFIGSET_TH1 },
#endif
#ifdef FOSSIL_ENABLE_TH1_HOOKS
{ "th1-hooks", CONFIGSET_TH1 },
#endif
{ "th1-setup", CONFIGSET_TH1 },
|
| ︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
#ifdef FOSSIL_ENABLE_LEGACY_MV_RM
{ "move-files", CONFIGSET_PROJ },
{ "remove-files", CONFIGSET_PROJ },
#endif
{ "ticket-table", CONFIGSET_TKT },
| > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "dotfiles", CONFIGSET_PROJ },
#ifdef FOSSIL_ENABLE_LEGACY_MV_RM
{ "move-files", CONFIGSET_PROJ },
{ "remove-files", CONFIGSET_PROJ },
#endif
{ "ticket-table", CONFIGSET_TKT },
|
| ︙ | ︙ | |||
860 861 862 863 864 865 866 | ** ** %fossil configuration push AREA ?URL? ** ** Push the local configuration into the remote server identified ** by URL. Admin privilege is required on the remote server for ** this to work. When the same record exists both locally and on ** the remote end, the one that was most recently changed wins. | | | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | ** ** %fossil configuration push AREA ?URL? ** ** Push the local configuration into the remote server identified ** by URL. Admin privilege is required on the remote server for ** this to work. When the same record exists both locally and on ** the remote end, the one that was most recently changed wins. ** Use the --legacy flag when talking to older servers. ** ** %fossil configuration reset AREA ** ** Restore the configuration to the default. AREA as above. ** ** %fossil configuration sync AREA ?URL? ** |
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
1473 1474 1475 1476 1477 1478 1479 |
" VALUES('developer','','dei','Dev');"
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('reader','','kptw','Reader');"
);
}
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 |
" VALUES('developer','','dei','Dev');"
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('reader','','kptw','Reader');"
);
}
}
/*
** Return a pointer to a string that contains the RHS of an IN operator
** that will select CONFIG table names that are in the list of control
** settings.
*/
const char *db_setting_inop_rhs(){
Blob x;
|
| ︙ | ︙ | |||
1546 1547 1548 1549 1550 1551 1552 | ** that is automatically created. If zInitialDate is 0 then no initial ** check-in is created. The makeServerCodes flag determines whether or ** not server and project codes are invented for this repository. */ void db_initial_setup( const char *zTemplate, /* Repository from which to copy settings. */ const char *zInitialDate, /* Initial date of repository. (ex: "now") */ | | < > > | > | < > | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 |
** that is automatically created. If zInitialDate is 0 then no initial
** check-in is created. The makeServerCodes flag determines whether or
** not server and project codes are invented for this repository.
*/
void db_initial_setup(
const char *zTemplate, /* Repository from which to copy settings. */
const char *zInitialDate, /* Initial date of repository. (ex: "now") */
const char *zDefaultUser /* Default user for the repository */
){
char *zDate;
Blob hash;
Blob manifest;
db_set("content-schema", CONTENT_SCHEMA, 0);
db_set("aux-schema", AUX_SCHEMA_MAX, 0);
db_set("rebuilt", get_version(), 0);
db_multi_exec(
"INSERT INTO config(name,value,mtime)"
" VALUES('server-code', lower(hex(randomblob(20))),now());"
"INSERT INTO config(name,value,mtime)"
" VALUES('project-code', lower(hex(randomblob(20))),now());"
);
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
if( !db_is_global("timeline-plaintext") ){
db_set_int("timeline-plaintext", 1, 0);
}
db_create_default_users(0, zDefaultUser);
if( zDefaultUser ) g.zLogin = zDefaultUser;
|
| ︙ | ︙ | |||
1685 1686 1687 1688 1689 1690 1691 | db_create_repository(g.argv[2]); db_open_repository(g.argv[2]); db_open_config(0); if( zTemplate ) db_attach(zTemplate, "settingSrc"); db_begin_transaction(); if( zDate==0 ) zDate = "now"; | | | 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 |
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_transaction();
if( zDate==0 ) zDate = "now";
db_initial_setup(zTemplate, zDate, zDefaultUser);
db_end_transaction(0);
if( zTemplate ) db_detach("settingSrc");
fossil_print("project-id: %s\n", db_get("project-code", 0));
fossil_print("server-id: %s\n", db_get("server-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
fossil_print("admin-user: %s (initial password is \"%s\")\n",
g.zLogin, zPassword);
|
| ︙ | ︙ | |||
2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 |
{ "clean-glob", 0, 40, 1, 0, "" },
{ "clearsign", 0, 0, 0, 0, "off" },
{ "crnl-glob", 0, 40, 1, 0, "" },
{ "default-perms", 0, 16, 0, 0, "u" },
{ "diff-binary", 0, 0, 0, 0, "on" },
{ "diff-command", 0, 40, 0, 0, "" },
{ "dont-push", 0, 0, 0, 0, "off" },
{ "editor", 0, 32, 0, 0, "" },
{ "empty-dirs", 0, 40, 1, 0, "" },
{ "encoding-glob", 0, 40, 1, 0, "" },
{ "gdiff-command", 0, 40, 0, 0, "gdiff" },
{ "gmerge-command", 0, 40, 0, 0, "" },
{ "hash-digits", 0, 5, 0, 0, "10" },
{ "http-port", 0, 16, 0, 0, "8080" },
| > | 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 |
{ "clean-glob", 0, 40, 1, 0, "" },
{ "clearsign", 0, 0, 0, 0, "off" },
{ "crnl-glob", 0, 40, 1, 0, "" },
{ "default-perms", 0, 16, 0, 0, "u" },
{ "diff-binary", 0, 0, 0, 0, "on" },
{ "diff-command", 0, 40, 0, 0, "" },
{ "dont-push", 0, 0, 0, 0, "off" },
{ "dotfiles", 0, 0, 0, 0, "off" },
{ "editor", 0, 32, 0, 0, "" },
{ "empty-dirs", 0, 40, 1, 0, "" },
{ "encoding-glob", 0, 40, 1, 0, "" },
{ "gdiff-command", 0, 40, 0, 0, "gdiff" },
{ "gmerge-command", 0, 40, 0, 0, "" },
{ "hash-digits", 0, 5, 0, 0, "10" },
{ "http-port", 0, 16, 0, 0, "8080" },
|
| ︙ | ︙ | |||
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 | ** external diff programs. If FALSE, skip these files. ** ** diff-command External command to run when performing a diff. ** If undefined, the internal text diff will be used. ** ** dont-push Prevent this repository from pushing from client to ** server. Useful when setting up a private branch. ** ** editor Text editor command used for check-in comments. ** ** empty-dirs A comma or newline-separated list of pathnames. On ** (versionable) update and checkout commands, if no file or directory ** exists with that name, an empty directory will be ** created. | > > | 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 | ** external diff programs. If FALSE, skip these files. ** ** diff-command External command to run when performing a diff. ** If undefined, the internal text diff will be used. ** ** dont-push Prevent this repository from pushing from client to ** server. Useful when setting up a private branch. ** ** dotfiles Include --dotfiles option for all compatible commands. ** ** editor Text editor command used for check-in comments. ** ** empty-dirs A comma or newline-separated list of pathnames. On ** (versionable) update and checkout commands, if no file or directory ** exists with that name, an empty directory will be ** created. |
| ︙ | ︙ |
Changes to src/doc.c.
| ︙ | ︙ | |||
638 639 640 641 642 643 644 |
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(&filebody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zName,-1);
style_header("%s", blob_str(&title));
blob_append(cgi_output_blob(), blob_buffer(&filebody),blob_size(&filebody));
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
| | | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(&filebody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zName,-1);
style_header("%s", blob_str(&title));
blob_append(cgi_output_blob(), blob_buffer(&filebody),blob_size(&filebody));
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
}else if( Th_AreDocsEnabled() &&
fossil_strcmp(zMime, "application/x-th1")==0 ){
style_header("%h", zName);
Th_Render(blob_str(&filebody));
style_footer();
#endif
}else{
cgi_set_content_type(zMime);
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@sqlite.org ** ******************************************************************************* ** | | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@sqlite.org ** ******************************************************************************* ** ** This file contains code used to import the content of a Git/SVN ** repository in the git-fast-import/svn-dump formats as a new Fossil ** repository. */ #include "config.h" #include "import.h" #include <assert.h> #if INTERFACE |
| ︙ | ︙ | |||
514 515 516 517 518 519 520 |
** tag to the new commit. However, if there are multiple instances
** of pattern B with the same TAGNAME, then only put the tag on the
** last commit that holds that tag.
**
** None of the above is explained in the git-fast-export
** documentation. We had to figure it out via trial and error.
*/
| | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
** tag to the new commit. However, if there are multiple instances
** of pattern B with the same TAGNAME, then only put the tag on the
** last commit that holds that tag.
**
** None of the above is explained in the git-fast-export
** documentation. We had to figure it out via trial and error.
*/
for(i=5; i<strlen(z) && z[i]!='/'; i++){}
gg.tagCommit = strncmp(&z[5], "tags", 4)==0; /* True for pattern B */
if( z[i+1]!=0 ) z += i+1;
if( fossil_strcmp(z, "master")==0 ) z = "trunk";
gg.zBranch = fossil_strdup(z);
gg.fromLoaded = 0;
}else
if( strncmp(zLine, "tag ", 4)==0 ){
gg.xFinish();
|
| ︙ | ︙ | |||
714 715 716 717 718 719 720 721 722 723 724 |
return;
malformed_line:
trim_newline(zLine);
fossil_fatal("bad fast-import line: [%s]", zLine);
return;
}
/*
** COMMAND: import
**
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | < | > > > > > > > > > > > > > > > < < < > > > | > > > > > > > > > > > > > > | > > | | | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 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 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 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 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 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 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 1057 1058 1059 1060 1061 1062 1063 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 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 |
return;
malformed_line:
trim_newline(zLine);
fossil_fatal("bad fast-import line: [%s]", zLine);
return;
}
static struct{
int rev; /* SVN revision number */
char *zDate; /* Date/time stamp */
char *zUser; /* User name */
char *zComment; /* Comment of a commit */
const char *zTrunk; /* Name of trunk folder in repo root */
int lenTrunk; /* String length of zTrunk */
const char *zBranches; /* Name of branches folder in repo root */
int lenBranches; /* String length of zBranches */
const char *zTags; /* Name of tags folder in repo root */
int lenTags; /* String length of zTags */
Bag newBranches; /* Branches that were created in this revision */
int incrFlag; /* Add svn-rev-nn tags on every checkin */
} gsvn;
typedef struct {
char *zKey;
char *zVal;
} KeyVal;
typedef struct {
KeyVal *aHeaders;
int nHeaders;
char *pRawProps;
KeyVal *aProps;
int nProps;
Blob content;
int contentFlag;
} SvnRecord;
#define svn_find_header(rec, zHeader) \
svn_find_keyval((rec).aHeaders, (rec).nHeaders, (zHeader))
#define svn_find_prop(rec, zProp) \
svn_find_keyval((rec).aProps, (rec).nProps, (zProp))
static char *svn_find_keyval(
KeyVal *aKeyVal,
int nKeyVal,
const char *zKey
){
int i;
for(i=0; i<nKeyVal; i++){
if( fossil_strcmp(aKeyVal[i].zKey, zKey)==0 ){
return aKeyVal[i].zVal;
}
}
return 0;
}
static void svn_free_rec(SvnRecord *rec){
int i;
for(i=0; i<rec->nHeaders; i++){
fossil_free(rec->aHeaders[i].zKey);
}
fossil_free(rec->aHeaders);
fossil_free(rec->aProps);
fossil_free(rec->pRawProps);
blob_reset(&rec->content);
}
static int svn_read_headers(FILE *pIn, SvnRecord *rec){
char zLine[1000];
rec->aHeaders = 0;
rec->nHeaders = 0;
while( fgets(zLine, sizeof(zLine), pIn) ){
if( zLine[0]!='\n' ) break;
}
if( feof(pIn) ) return 0;
do{
char *sep;
if( zLine[0]=='\n' ) break;
rec->nHeaders += 1;
rec->aHeaders = fossil_realloc(rec->aHeaders,
sizeof(rec->aHeaders[0])*rec->nHeaders);
rec->aHeaders[rec->nHeaders-1].zKey = mprintf("%s", zLine);
sep = strchr(rec->aHeaders[rec->nHeaders-1].zKey, ':');
if( !sep ){
trim_newline(zLine);
fossil_fatal("bad header line: [%s]", zLine);
}
*sep = 0;
rec->aHeaders[rec->nHeaders-1].zVal = sep+1;
sep = strchr(rec->aHeaders[rec->nHeaders-1].zVal, '\n');
*sep = 0;
while(rec->aHeaders[rec->nHeaders-1].zVal
&& fossil_isspace(*(rec->aHeaders[rec->nHeaders-1].zVal)) )
{
rec->aHeaders[rec->nHeaders-1].zVal++;
}
}while( fgets(zLine, sizeof(zLine), pIn) );
if( zLine[0]!='\n' ){
trim_newline(zLine);
fossil_fatal("svn-dump data ended unexpectedly");
}
return 1;
}
static void svn_read_props(FILE *pIn, SvnRecord *rec){
int nRawProps = 0;
char *pRawProps;
const char *zLen;
rec->pRawProps = 0;
rec->aProps = 0;
rec->nProps = 0;
zLen = svn_find_header(*rec, "Prop-content-length");
if( zLen ){
nRawProps = atoi(zLen);
}
if( nRawProps ){
int got;
char *zLine;
rec->pRawProps = pRawProps = fossil_malloc( nRawProps );
got = fread(rec->pRawProps, 1, nRawProps, pIn);
if( got!=nRawProps ){
fossil_fatal("short read: got %d of %d bytes", got, nRawProps);
}
if( memcmp(&pRawProps[got-10], "PROPS-END\n", 10)!=0 ){
fossil_fatal("svn-dump data ended unexpectedly");
}
zLine = pRawProps;
while( zLine<(pRawProps+nRawProps-10) ){
char *eol;
int propLen;
if( zLine[0]=='D' ){
propLen = atoi(&zLine[2]);
eol = strchr(zLine, '\n');
zLine = eol+1+propLen+1;
}else{
if( zLine[0]!='K' ){
fossil_fatal("svn-dump data format broken");
}
propLen = atoi(&zLine[2]);
eol = strchr(zLine, '\n');
zLine = eol+1;
eol = zLine+propLen;
if( *eol!='\n' ){
fossil_fatal("svn-dump data format broken");
}
*eol = 0;
rec->nProps += 1;
rec->aProps = fossil_realloc(rec->aProps,
sizeof(rec->aProps[0])*rec->nProps);
rec->aProps[rec->nProps-1].zKey = zLine;
zLine = eol+1;
if( zLine[0]!='V' ){
fossil_fatal("svn-dump data format broken");
}
propLen = atoi(&zLine[2]);
eol = strchr(zLine, '\n');
zLine = eol+1;
eol = zLine+propLen;
if( *eol!='\n' ){
fossil_fatal("svn-dump data format broken");
}
*eol = 0;
rec->aProps[rec->nProps-1].zVal = zLine;
zLine = eol+1;
}
}
}
}
static int svn_read_rec(FILE *pIn, SvnRecord *rec){
const char *zLen;
int nLen = 0;
if( svn_read_headers(pIn, rec)==0 ) return 0;
svn_read_props(pIn, rec);
blob_zero(&rec->content);
zLen = svn_find_header(*rec, "Text-content-length");
if( zLen ){
rec->contentFlag = 1;
nLen = atoi(zLen);
blob_read_from_channel(&rec->content, pIn, nLen);
if( blob_size(&rec->content)!=nLen ){
fossil_fatal("short read: got %d of %d bytes",
blob_size(&rec->content), nLen
);
}
}else{
rec->contentFlag = 0;
}
return 1;
}
/*
** Returns the UUID for the RID, or NULL if not found.
** The returned string is allocated via db_text() and must be
** free()d by the caller.
*/
char * rid_to_uuid(int rid)
{
return db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}
#define SVN_UNKNOWN 0
#define SVN_TRUNK 1
#define SVN_BRANCH 2
#define SVN_TAG 3
#define MAX_INT_32 (0x7FFFFFFFL)
static void svn_finish_revision(){
Blob manifest;
static Stmt getChanges;
static Stmt getFiles;
static Stmt setRid;
Blob mcksum;
blob_zero(&manifest);
db_static_prepare(&getChanges, "SELECT tid, tname, ttype, tparent"
" FROM xrevisions, xbranches ON (tbranch=tid)"
" WHERE trid ISNULL");
db_static_prepare(&getFiles, "SELECT tpath, tuuid, tperm FROM xfiles"
" WHERE tbranch=:branch ORDER BY tpath");
db_prepare(&setRid, "UPDATE xrevisions SET trid=:rid"
" WHERE trev=%d AND tbranch=:branch", gsvn.rev);
while( db_step(&getChanges)==SQLITE_ROW ){
int branchId = db_column_int(&getChanges, 0);
const char *zBranch = db_column_text(&getChanges, 1);
int branchType = db_column_int(&getChanges, 2);
int parentRid = db_column_int(&getChanges, 3);
int mergeRid = parentRid;
Manifest *pParentManifest = 0;
ManifestFile *pParentFile = 0;
int sameAsParent = 1;
int parentBranch = 0;
if( !bag_find(&gsvn.newBranches, branchId) ){
parentRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions"
" WHERE trev<%d AND tbranch=%d",
gsvn.rev, branchId);
}
if( parentRid>0 ){
pParentManifest = manifest_get(parentRid, CFTYPE_MANIFEST, 0);
pParentFile = manifest_file_next(pParentManifest, 0);
parentBranch = db_int(0, "SELECT tbranch FROM xrevisions WHERE trid=%d",
parentRid);
if( parentBranch!=branchId && branchType!=SVN_TAG ){
sameAsParent = 0;
}
}
if( mergeRid<MAX_INT_32 ){
if( gsvn.zComment ){
blob_appendf(&manifest, "C %F\n", gsvn.zComment);
}else{
blob_append(&manifest, "C (no\\scomment)\n", 16);
}
blob_appendf(&manifest, "D %s\n", gsvn.zDate);
db_bind_int(&getFiles, ":branch", branchId);
while( db_step(&getFiles)==SQLITE_ROW ){
const char *zFile = db_column_text(&getFiles, 0);
const char *zUuid = db_column_text(&getFiles, 1);
const char *zPerm = db_column_text(&getFiles, 2);
if( zPerm ){
blob_appendf(&manifest, "F %F %s %s\n", zFile, zUuid, zPerm);
}else{
blob_appendf(&manifest, "F %F %s\n", zFile, zUuid);
}
if( sameAsParent ){
if( !pParentFile
|| fossil_strcmp(pParentFile->zName,zFile)!=0
|| fossil_strcmp(pParentFile->zUuid,zUuid)!=0
|| fossil_strcmp(pParentFile->zPerm,zPerm)!=0
){
sameAsParent = 0;
}else{
pParentFile = manifest_file_next(pParentManifest, 0);
}
}
}
if( pParentFile ){
sameAsParent = 0;
}
db_reset(&getFiles);
if( !sameAsParent ){
if( parentRid>0 ){
char *zParentUuid = rid_to_uuid(parentRid);
if( parentRid==mergeRid || mergeRid==0){
char *zParentBranch =
db_text(0, "SELECT tname FROM xbranches WHERE tid=%d",
parentBranch
);
blob_appendf(&manifest, "P %s\n", zParentUuid);
blob_appendf(&manifest, "T *branch * %F\n", zBranch);
blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
if( gsvn.incrFlag ){
blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
}
blob_appendf(&manifest, "T -sym-%F *\n", zParentBranch);
fossil_free(zParentBranch);
}else{
char *zMergeUuid = rid_to_uuid(mergeRid);
blob_appendf(&manifest, "P %s %s\n", zParentUuid, zMergeUuid);
if( gsvn.incrFlag ){
blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
}
fossil_free(zMergeUuid);
}
fossil_free(zParentUuid);
}else{
blob_appendf(&manifest, "T *branch * %F\n", zBranch);
blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
if( gsvn.incrFlag ){
blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
}
}
}else if( branchType==SVN_TAG ){
char *zParentUuid = rid_to_uuid(parentRid);
blob_reset(&manifest);
blob_appendf(&manifest, "D %s\n", gsvn.zDate);
blob_appendf(&manifest, "T +sym-%F %s\n", zBranch, zParentUuid);
fossil_free(zParentUuid);
}
}else{
char *zParentUuid = rid_to_uuid(parentRid);
blob_appendf(&manifest, "D %s\n", gsvn.zDate);
if( branchType!=SVN_TAG ){
blob_appendf(&manifest, "T +closed %s\n", zParentUuid);
}else{
blob_appendf(&manifest, "T -sym-%F %s\n", zBranch, zParentUuid);
}
fossil_free(zParentUuid);
}
if( gsvn.zUser ){
blob_appendf(&manifest, "U %F\n", gsvn.zUser);
}else{
const char *zUserOvrd = find_option("user-override",0,1);
blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : login_name());
}
md5sum_blob(&manifest, &mcksum);
blob_appendf(&manifest, "Z %b\n", &mcksum);
blob_reset(&mcksum);
if( !sameAsParent ){
int rid = content_put(&manifest);
db_bind_int(&setRid, ":branch", branchId);
db_bind_int(&setRid, ":rid", rid);
db_step(&setRid);
db_reset(&setRid);
}else if( branchType==SVN_TAG ){
content_put(&manifest);
db_bind_int(&setRid, ":branch", branchId);
db_bind_int(&setRid, ":rid", parentRid);
db_step(&setRid);
db_reset(&setRid);
}else if( mergeRid==MAX_INT_32 ){
content_put(&manifest);
db_multi_exec("DELETE FROM xrevisions WHERE tbranch=%d AND trev=%d",
branchId, gsvn.rev);
}else{
db_multi_exec("DELETE FROM xrevisions WHERE tbranch=%d AND trev=%d",
branchId, gsvn.rev);
}
blob_reset(&manifest);
manifest_destroy(pParentManifest);
}
db_reset(&getChanges);
db_finalize(&setRid);
}
static u64 svn_get_varint(const char **pz){
unsigned int v = 0;
do{
v = (v<<7) | ((*pz)[0]&0x7f);
}while( (*pz)++[0]&0x80 );
return v;
}
static void svn_apply_svndiff(Blob *pDiff, Blob *pSrc, Blob *pOut){
const char *zDiff = blob_buffer(pDiff);
char *zOut;
if( blob_size(pDiff)<4 || memcmp(zDiff, "SVN", 4)!=0 ){
fossil_fatal("Invalid svndiff0 format");
}
zDiff += 4;
blob_zero(pOut);
while( zDiff<(blob_buffer(pDiff)+blob_size(pDiff)) ){
u64 lenOut, lenInst, lenData, lenOld;
const char *zInst;
const char *zData;
u64 offSrc = svn_get_varint(&zDiff);
/*lenSrc =*/ svn_get_varint(&zDiff);
lenOut = svn_get_varint(&zDiff);
lenInst = svn_get_varint(&zDiff);
lenData = svn_get_varint(&zDiff);
zInst = zDiff;
zData = zInst+lenInst;
lenOld = blob_size(pOut);
blob_resize(pOut, lenOut+lenOld);
zOut = blob_buffer(pOut)+lenOld;
while( zDiff<zInst+lenInst ){
u64 lenCpy = (*zDiff)&0x3f;
const char *zCpy;
switch( (*zDiff)&0xC0 ){
case 0x00: zCpy = blob_buffer(pSrc)+offSrc; break;
case 0x40: zCpy = blob_buffer(pOut); break;
case 0x80: zCpy = zData; break;
default: fossil_fatal("Invalid svndiff0 instruction");
}
zDiff++;
if( lenCpy==0 ){
lenCpy = svn_get_varint(&zDiff);
}
if( zCpy!=zData ){
zCpy += svn_get_varint(&zDiff);
}else{
zData += lenCpy;
}
while( lenCpy-- > 0 ){
*zOut++ = *zCpy++;
}
}
zDiff += lenData;
}
}
/*
** Extract the branch or tag that the given path is on. Return the branch ID.
*/
static int svn_parse_path(char *zPath, char **zFile, int *type){
char *zBranch = 0;
int branchId = 0;
*type = SVN_UNKNOWN;
*zFile = 0;
if( gsvn.lenTrunk==0 ){
zBranch = "trunk";
*zFile = zPath;
*type = SVN_TRUNK;
}else
if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){
zBranch = "trunk";
*zFile = zPath+gsvn.lenTrunk;
*type = SVN_TRUNK;
}else{
zBranch = 0;
*type = SVN_UNKNOWN;
}
}else{
if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){
*zFile = zBranch = zPath+gsvn.lenBranches;
*type = SVN_BRANCH;
}else
if( strncmp(zPath, gsvn.zTags, gsvn.lenTags)==0 ){
*zFile = zBranch = zPath+gsvn.lenTags;
*type = SVN_TAG;
}else{ /* Not a branch, tag or trunk */
return 0;
}
while( **zFile && **zFile!='/' ){ (*zFile)++; }
if( **zFile ){
**zFile = '\0';
(*zFile)++;
}
}
if( *type!=SVN_UNKNOWN ){
branchId = db_int(0,
"SELECT tid FROM xbranches WHERE tname=%Q AND ttype=%d",
zBranch, *type);
if( branchId==0 ){
db_multi_exec("INSERT INTO xbranches (tname, ttype) VALUES(%Q, %d)",
zBranch, *type);
branchId = db_last_insert_rowid();
}
}
return branchId;
}
/*
** Read the svn-dump format from pIn and insert the corresponding
** content into the database.
*/
static void svn_dump_import(FILE *pIn){
SvnRecord rec;
int ver;
char *zTemp;
const char *zUuid;
Stmt addFile;
Stmt delPath;
Stmt addRev;
Stmt cpyPath;
Stmt cpyRoot;
Stmt revSrc;
/* version */
if( svn_read_rec(pIn, &rec)
&& (zTemp = svn_find_header(rec, "SVN-fs-dump-format-version")) ){
ver = atoi(zTemp);
if( ver!=2 && ver!=3 ){
fossil_fatal("Unknown svn-dump format version: %d", ver);
}
}else{
fossil_fatal("Input is not an svn-dump!");
}
svn_free_rec(&rec);
/* UUID */
if( !svn_read_rec(pIn, &rec) || !(zUuid = svn_find_header(rec, "UUID")) ){
/* Removed the following line since UUID is not actually used
fossil_fatal("Missing UUID!"); */
}
svn_free_rec(&rec);
/* content */
db_prepare(&addFile,
"INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)"
" VALUES(:path, :branch, (SELECT uuid FROM blob WHERE rid=:rid), :perm)"
);
db_prepare(&delPath,
"DELETE FROM xfiles"
" WHERE (tpath=:path OR (tpath>:path||'/' AND tpath<:path||'0'))"
" AND tbranch=:branch"
);
db_prepare(&addRev,
"INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)"
);
db_prepare(&cpyPath,
"INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)"
" SELECT :path||:sep||substr(filename, length(:srcpath)+2), :branch, uuid, perm"
" FROM xfoci"
" WHERE checkinID=:rid"
" AND filename>:srcpath||'/'"
" AND filename<:srcpath||'0'"
);
db_prepare(&cpyRoot,
"INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)"
" SELECT :path||:sep||filename, :branch, uuid, perm"
" FROM xfoci"
" WHERE checkinID=:rid"
);
db_prepare(&revSrc,
"UPDATE xrevisions SET tparent=:parent"
" WHERE trev=:rev AND tbranch=:branch AND tparent<:parent"
);
gsvn.rev = -1;
bag_init(&gsvn.newBranches);
while( svn_read_rec(pIn, &rec) ){
if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */
/* finish previous revision */
char *zDate = NULL;
if( gsvn.rev>=0 ){
svn_finish_revision();
fossil_free(gsvn.zUser);
fossil_free(gsvn.zComment);
fossil_free(gsvn.zDate);
bag_clear(&gsvn.newBranches);
}
/* start new revision */
gsvn.rev = atoi(zTemp);
gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
zDate = svn_find_prop(rec, "svn:date");
if( zDate ){
gsvn.zDate = date_in_standard_format(zDate);
}else{
gsvn.zDate = date_in_standard_format("now");
}
db_bind_int(&addRev, ":rev", gsvn.rev);
fossil_print("\rImporting SVN revision: %d", gsvn.rev);
}else
if( (zTemp = svn_find_header(rec, "Node-path")) ){ /* file/dir node */
char *zFile;
int branchType;
int branchId = svn_parse_path(zTemp, &zFile, &branchType);
char *zAction = svn_find_header(rec, "Node-action");
char *zKind = svn_find_header(rec, "Node-kind");
char *zPerm = svn_find_prop(rec, "svn:executable") ? "x" : 0;
int deltaFlag = 0;
int srcRev = 0;
if( branchId==0 ){
svn_free_rec(&rec);
continue;
}
if( (zTemp = svn_find_header(rec, "Text-delta")) ){
deltaFlag = strncmp(zTemp, "true", 4)==0;
}
if( strncmp(zAction, "delete", 6)==0
|| strncmp(zAction, "replace", 7)==0 )
{
db_bind_int(&addRev, ":branch", branchId);
db_step(&addRev);
db_reset(&addRev);
if( zFile[0]!=0 ){
db_bind_text(&delPath, ":path", zFile);
db_bind_int(&delPath, ":branch", branchId);
db_step(&delPath);
db_reset(&delPath);
}else{
db_multi_exec("DELETE FROM xfiles WHERE tbranch=%d", branchId);
db_bind_int(&revSrc, ":parent", MAX_INT_32);
db_bind_int(&revSrc, ":rev", gsvn.rev);
db_bind_int(&revSrc, ":branch", branchId);
db_step(&revSrc);
db_reset(&revSrc);
}
} /* no 'else' here since 'replace' does both a 'delete' and an 'add' */
if( strncmp(zAction, "add", 3)==0
|| strncmp(zAction, "replace", 7)==0 )
{
char *zSrcPath = svn_find_header(rec, "Node-copyfrom-path");
char *zSrcFile;
int srcRid = 0;
if( zSrcPath ){
int srcBranch;
zTemp = svn_find_header(rec, "Node-copyfrom-rev");
if( zTemp ){
srcRev = atoi(zTemp);
}else{
fossil_fatal("Missing copyfrom-rev");
}
srcBranch = svn_parse_path(zSrcPath, &zSrcFile, &branchType);
if( srcBranch==0 ){
fossil_fatal("Copy from path outside the import paths");
}
srcRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions"
" WHERE trev<=%d AND tbranch=%d",
srcRev, srcBranch);
if( srcRid>0 && srcBranch!=branchId ){
db_bind_int(&addRev, ":branch", branchId);
db_step(&addRev);
db_reset(&addRev);
db_bind_int(&revSrc, ":parent", srcRid);
db_bind_int(&revSrc, ":rev", gsvn.rev);
db_bind_int(&revSrc, ":branch", branchId);
db_step(&revSrc);
db_reset(&revSrc);
}
}
if( zKind==0 ){
fossil_fatal("Missing Node-kind");
}else if( strncmp(zKind, "dir", 3)==0 ){
if( zSrcPath ){
if( srcRid>0 ){
if( zSrcFile[0]==0 ){
db_bind_text(&cpyRoot, ":path", zFile);
if( zFile[0]!=0 ){
db_bind_text(&cpyRoot, ":sep", "/");
}else{
db_bind_text(&cpyRoot, ":sep", "");
}
db_bind_int(&cpyRoot, ":branch", branchId);
db_bind_int(&cpyRoot, ":rid", srcRid);
db_step(&cpyRoot);
db_reset(&cpyRoot);
}else{
db_bind_text(&cpyPath, ":path", zFile);
if( zFile[0]!=0 ){
db_bind_text(&cpyPath, ":sep", "/");
}else{
db_bind_text(&cpyPath, ":sep", "");
}
db_bind_int(&cpyPath, ":branch", branchId);
db_bind_text(&cpyPath, ":srcpath", zSrcFile);
db_bind_int(&cpyPath, ":rid", srcRid);
db_step(&cpyPath);
db_reset(&cpyPath);
}
}
}
if( zFile[0]==0 ){
bag_insert(&gsvn.newBranches, branchId);
}
}else{
int rid = 0;
if( zSrcPath ){
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=("
" SELECT uuid FROM xfoci"
" WHERE checkinID=%d AND filename=%Q"
")",
srcRid, zSrcFile);
}
if( deltaFlag ){
Blob deltaSrc;
Blob target;
if( rid!=0 ){
content_get(rid, &deltaSrc);
}else{
blob_zero(&deltaSrc);
}
svn_apply_svndiff(&rec.content, &deltaSrc, &target);
rid = content_put(&target);
}else if( rec.contentFlag ){
rid = content_put(&rec.content);
}
db_bind_text(&addFile, ":path", zFile);
db_bind_int(&addFile, ":branch", branchId);
db_bind_int(&addFile, ":rid", rid);
db_bind_text(&addFile, ":perm", zPerm);
db_step(&addFile);
db_reset(&addFile);
db_bind_int(&addRev, ":branch", branchId);
db_step(&addRev);
db_reset(&addRev);
}
}else
if( strncmp(zAction, "change", 6)==0 ){
int rid = 0;
if( zKind==0 ){
fossil_fatal("Missing Node-kind");
}
if( strncmp(zKind, "dir", 3)!=0 ){
if( deltaFlag ){
Blob deltaSrc;
Blob target;
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=("
" SELECT uuid FROM xfiles"
" WHERE tpath=%Q AND tbranch=%d"
")", zFile, branchId);
content_get(rid, &deltaSrc);
svn_apply_svndiff(&rec.content, &deltaSrc, &target);
rid = content_put(&target);
}else{
rid = content_put(&rec.content);
}
db_bind_text(&addFile, ":path", zFile);
db_bind_int(&addFile, ":branch", branchId);
db_bind_int(&addFile, ":rid", rid);
db_bind_text(&addFile, ":perm", zPerm);
db_step(&addFile);
db_reset(&addFile);
db_bind_int(&addRev, ":branch", branchId);
db_step(&addRev);
db_reset(&addRev);
}
}else
if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this one above */
fossil_fatal("Unknown Node-action");
}
}else{
fossil_fatal("Unknown record type");
}
svn_free_rec(&rec);
}
svn_finish_revision();
fossil_free(gsvn.zUser);
fossil_free(gsvn.zComment);
fossil_free(gsvn.zDate);
db_finalize(&addFile);
db_finalize(&delPath);
db_finalize(&addRev);
db_finalize(&cpyPath);
db_finalize(&cpyRoot);
db_finalize(&revSrc);
fossil_print(" Done!\n");
}
/*
** COMMAND: import
**
** Usage: %fossil import ?--git? ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
** or: %fossil import --svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
**
** Read interchange format generated by another VCS and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY
** argument. If no input file is supplied the interchange format
** data is read from standard input.
**
** The following formats are currently understood by this command
**
** --git Import from the git-fast-export file format (default)
**
** --svn Import from the svnadmin-dump file format. The default
** behaviour (unless overridden by --flat) is to treat 3
** folders in the SVN root as special, following the
** common layout of SVN repositories. These are (by
** default) trunk/, branches/ and tags/
** Options:
** --trunk FOLDER Name of trunk folder
** --branches FOLDER Name of branches folder
** --tags FOLDER Name of tags folder
** --base PATH Path to project root in repository
** --flat The whole dump is a single branch
**
** Common Options:
** -i|--incremental allow importing into an existing repository
** -f|--force overwrite repository if already exist
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
int svnFlag = find_option("svn", 0, 0)!=0;
/* Options common to all input formats */
int incrFlag = find_option("incremental", "i", 0)!=0;
/* Options for --svn only */
const char *zBase="";
int flatFlag=0;
if( svnFlag ){
/* Get --svn related options here, so verify_all_options() fail when svn
* only option are specify with --git
*/
zBase = find_option("base", 0, 1);
flatFlag = find_option("flat", 0, 0)!=0;
gsvn.zTrunk = find_option("trunk", 0, 1);
gsvn.zBranches = find_option("branches", 0, 1);
gsvn.zTags = find_option("tags", 0, 1);
gsvn.incrFlag = incrFlag;
}else{
find_option("git",0,0); /* Skip the --git option for now */
}
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
pIn = fossil_fopen(g.argv[3], "rb");
}else{
pIn = stdin;
fossil_binary_mode(pIn);
}
if( !incrFlag ){
if( forceFlag ) file_delete(g.argv[2]);
db_create_repository(g.argv[2]);
}
db_open_repository(g.argv[2]);
db_open_config(0);
db_begin_transaction();
if( !incrFlag ) db_initial_setup(0, 0, 0);
if( svnFlag ){
db_multi_exec(
"CREATE TEMP TABLE xrevisions("
" trev INTEGER, tbranch INT, trid INT, tparent INT DEFAULT 0,"
" UNIQUE(tbranch, trev)"
");"
"CREATE INDEX temp.i_xrevisions ON xrevisions(trid);"
"CREATE TEMP TABLE xfiles("
" tpath TEXT, tbranch INT, tuuid TEXT, tperm TEXT,"
" UNIQUE (tbranch, tpath) ON CONFLICT REPLACE"
");"
"CREATE TEMP TABLE xbranches("
" tid INTEGER PRIMARY KEY, tname TEXT, ttype INT,"
" UNIQUE(tname, ttype)"
");"
"CREATE VIRTUAL TABLE temp.xfoci USING files_of_checkin;"
);
if( zBase==0 ){ zBase = ""; }
if( strlen(zBase)>0 ){
if( zBase[strlen(zBase)-1]!='/' ){
zBase = mprintf("%s/", zBase);
}
}
if( flatFlag ){
gsvn.zTrunk = zBase;
gsvn.zBranches = 0;
gsvn.zTags = 0;
gsvn.lenTrunk = strlen(zBase);
gsvn.lenBranches = 0;
gsvn.lenTags = 0;
}else{
if( gsvn.zTrunk==0 ){ gsvn.zTrunk = "trunk/"; }
if( gsvn.zBranches==0 ){ gsvn.zBranches = "branches/"; }
if( gsvn.zTags==0 ){ gsvn.zTags = "tags/"; }
gsvn.zTrunk = mprintf("%s%s", zBase, gsvn.zTrunk);
gsvn.zBranches = mprintf("%s%s", zBase, gsvn.zBranches);
gsvn.zTags = mprintf("%s%s", zBase, gsvn.zTags);
gsvn.lenTrunk = strlen(gsvn.zTrunk);
gsvn.lenBranches = strlen(gsvn.zBranches);
gsvn.lenTags = strlen(gsvn.zTags);
if( gsvn.zTrunk[gsvn.lenTrunk-1]!='/' ){
gsvn.zTrunk = mprintf("%s/", gsvn.zTrunk);
gsvn.lenTrunk++;
}
if( gsvn.zBranches[gsvn.lenBranches-1]!='/' ){
gsvn.zBranches = mprintf("%s/", gsvn.zBranches);
gsvn.lenBranches++;
}
if( gsvn.zTags[gsvn.lenTags-1]!='/' ){
gsvn.zTags = mprintf("%s/", gsvn.zTags);
gsvn.lenTags++;
}
}
svn_dump_import(pIn);
}else{
/* The following temp-tables are used to hold information needed for
** the import.
**
** The XMARK table provides a mapping from fast-import "marks" and symbols
** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
** Given any valid fast-import symbol, the corresponding fossil rid and
|
| ︙ | ︙ | |||
805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
Blob record;
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0);
import_reset(0);
}
db_finalize(&q);
}
db_end_transaction(0);
db_begin_transaction();
fossil_print("Rebuilding repository meta-data...\n");
rebuild_db(0, 1, !incrFlag);
verify_cancel();
db_end_transaction(0);
fossil_print("Vacuuming..."); fflush(stdout);
| > > | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 |
Blob record;
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0);
import_reset(0);
}
db_finalize(&q);
}
verify_cancel();
db_end_transaction(0);
db_begin_transaction();
fossil_print("Rebuilding repository meta-data...\n");
rebuild_db(0, 1, !incrFlag);
verify_cancel();
db_end_transaction(0);
fossil_print("Vacuuming..."); fflush(stdout);
|
| ︙ | ︙ |
Changes to src/json_config.c.
| ︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-change", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
{ "ticket-editpage", CONFIGSET_TKT },
| > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "dotfiles", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-change", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
{ "ticket-editpage", CONFIGSET_TKT },
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
2032 2033 2034 2035 2036 2037 2038 2039 | ** that check-out. ** ** Open the repository to be served if it is known. If g.argv[arg] is ** a directory full of repositories, then set g.zRepositoryName to ** the name of that directory and the specific repository will be ** opened later by process_one_web_page() based on the content of ** the PATH_INFO variable. */ | > > > | > > | > | | | > > > | > > > > > > > > > > > > > > > | 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 |
** that check-out.
**
** Open the repository to be served if it is known. If g.argv[arg] is
** a directory full of repositories, then set g.zRepositoryName to
** the name of that directory and the specific repository will be
** opened later by process_one_web_page() based on the content of
** the PATH_INFO variable.
**
** If the fCreate flag is set, then create the repository if it
** does not already exist.
*/
static void find_server_repository(int arg, int fCreate){
if( g.argc<=arg ){
db_must_be_within_tree();
}else{
const char *zRepo = g.argv[arg];
int isDir = file_isdir(zRepo);
if( isDir==1 ){
g.zRepositoryName = mprintf("%s", zRepo);
file_simplify_name(g.zRepositoryName, -1, 0);
}else{
if( isDir==0 && fCreate ){
const char *zPassword;
db_create_repository(zRepo);
db_open_repository(zRepo);
db_begin_transaction();
db_initial_setup(0, "now", g.zLogin);
db_end_transaction(0);
fossil_print("project-id: %s\n", db_get("project-code", 0));
fossil_print("server-id: %s\n", db_get("server-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
fossil_print("admin-user: %s (initial password is \"%s\")\n",
g.zLogin, zPassword);
cache_initialize();
g.zLogin = 0;
g.userUid = 0;
}else{
db_open_repository(zRepo);
}
}
}
}
/*
** undocumented format:
**
** fossil http INFILE OUTFILE IPADDR ?REPOSITORY?
|
| ︙ | ︙ | |||
2147 2148 2149 2150 2151 2152 2153 |
fossil_fatal("no repository specified");
}
g.fullHttpReply = 1;
if( g.argc>=5 ){
g.httpIn = fossil_fopen(g.argv[2], "rb");
g.httpOut = fossil_fopen(g.argv[3], "wb");
zIpAddr = g.argv[4];
| | | | 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 |
fossil_fatal("no repository specified");
}
g.fullHttpReply = 1;
if( g.argc>=5 ){
g.httpIn = fossil_fopen(g.argv[2], "rb");
g.httpOut = fossil_fopen(g.argv[3], "wb");
zIpAddr = g.argv[4];
find_server_repository(5, 0);
}else{
g.httpIn = stdin;
g.httpOut = stdout;
find_server_repository(2, 0);
}
if( zIpAddr==0 ){
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
}
}
|
| ︙ | ︙ | |||
2198 2199 2200 2201 2202 2203 2204 |
const char *zIpAddr; /* IP address of remote client */
Th_InitTraceLog();
login_set_capabilities("sx", 0);
g.useLocalauth = 1;
g.httpIn = stdin;
g.httpOut = stdout;
| | | 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 |
const char *zIpAddr; /* IP address of remote client */
Th_InitTraceLog();
login_set_capabilities("sx", 0);
g.useLocalauth = 1;
g.httpIn = stdin;
g.httpOut = stdout;
find_server_repository(2, 0);
g.cgiOutput = 1;
g.fullHttpReply = 1;
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
ssh_request_loop(zIpAddr, 0);
}else{
|
| ︙ | ︙ | |||
2255 2256 2257 2258 2259 2260 2261 | ** within an open checkout. ** ** The "ui" command automatically starts a web browser after initializing ** the web server. The "ui" command also binds to 127.0.0.1 and so will ** only process HTTP traffic from the local machine. ** ** The REPOSITORY can be a directory (aka folder) that contains one or | | | > | 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 | ** within an open checkout. ** ** The "ui" command automatically starts a web browser after initializing ** the web server. The "ui" command also binds to 127.0.0.1 and so will ** only process HTTP traffic from the local machine. ** ** The REPOSITORY can be a directory (aka folder) that contains one or ** more repositories with names ending in ".fossil". In this case, a ** prefix of the URL pathname is used to search the directory for an ** appropriate repository. To thwart mischief, the pathname in the URL must ** contain only alphanumerics, "_", "/", "-", and ".", and no "-" may ** occur after "/", and every "." must be surrounded on both sides by ** alphanumerics. Any pathname that does not satisfy these constraints ** results in a 404 error. Files in REPOSITORY that match the comma-separated ** list of glob patterns given by --files and that have known suffixes ** such as ".txt" or ".html" or ".jpeg" and do not match the pattern ** "*.fossil*" will be served as static content. With the "ui" command, ** the REPOSITORY can only be a directory if the --notfound option is ** also present. ** ** By default, the "ui" command provides full administrative access without ** having to log in. This can be disabled by turning off the "localauth" ** setting. Automatic login for the "server" command is available if the ** --localauth option is present and the "localauth" setting is off and the ** connection is from localhost. The "ui" command also enables --repolist ** by default. ** ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --create Create a new REPOSITORY if it does not already exist ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --nojail Drop root privileges but do not enter the chroot jail ** --notfound URL Redirect ** -P|--port TCPPORT listen to request on port TCPPORT ** --th-trace trace TH1 execution (for debugging purposes) |
| ︙ | ︙ | |||
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 |
#if !defined(_WIN32)
int noJail; /* Do not enter the chroot jail */
#endif
int allowRepoList; /* List repositories on URL "/" */
const char *zAltBase; /* Argument to the --baseurl option */
const char *zFileGlob; /* Static content must match this */
char *zIpAddr = 0; /* Bind to this IP address */
#if defined(_WIN32)
const char *zStopperFile; /* Name of file used to terminate server */
zStopperFile = find_option("stopper", 0, 1);
#endif
zFileGlob = find_option("files-urlenc",0,1);
| > | 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 |
#if !defined(_WIN32)
int noJail; /* Do not enter the chroot jail */
#endif
int allowRepoList; /* List repositories on URL "/" */
const char *zAltBase; /* Argument to the --baseurl option */
const char *zFileGlob; /* Static content must match this */
char *zIpAddr = 0; /* Bind to this IP address */
int fCreate = 0;
#if defined(_WIN32)
const char *zStopperFile; /* Name of file used to terminate server */
zStopperFile = find_option("stopper", 0, 1);
#endif
zFileGlob = find_option("files-urlenc",0,1);
|
| ︙ | ︙ | |||
2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 |
#endif
g.useLocalauth = find_option("localauth", 0, 0)!=0;
Th_InitTraceLog();
zPort = find_option("port", "P", 1);
zNotFound = find_option("notfound", 0, 1);
allowRepoList = find_option("repolist",0,0)!=0;
zAltBase = find_option("baseurl", 0, 1);
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
if( zAltBase ){
set_base_url(zAltBase);
}
if( find_option("localhost", 0, 0)!=0 ){
flags |= HTTP_SERVER_LOCALHOST;
}
/* We should be done with options.. */
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
isUiCmd = g.argv[1][0]=='u';
if( isUiCmd ){
flags |= HTTP_SERVER_LOCALHOST|HTTP_SERVER_REPOLIST;
g.useLocalauth = 1;
allowRepoList = 1;
}
| > | | 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 |
#endif
g.useLocalauth = find_option("localauth", 0, 0)!=0;
Th_InitTraceLog();
zPort = find_option("port", "P", 1);
zNotFound = find_option("notfound", 0, 1);
allowRepoList = find_option("repolist",0,0)!=0;
zAltBase = find_option("baseurl", 0, 1);
fCreate = find_option("create",0,0)!=0;
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
if( zAltBase ){
set_base_url(zAltBase);
}
if( find_option("localhost", 0, 0)!=0 ){
flags |= HTTP_SERVER_LOCALHOST;
}
/* We should be done with options.. */
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
isUiCmd = g.argv[1][0]=='u';
if( isUiCmd ){
flags |= HTTP_SERVER_LOCALHOST|HTTP_SERVER_REPOLIST;
g.useLocalauth = 1;
allowRepoList = 1;
}
find_server_repository(2, fCreate);
if( zPort ){
int i;
for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}
if( i>0 ){
zIpAddr = mprintf("%.*s", i, zPort);
zPort += i+1;
}
|
| ︙ | ︙ | |||
2388 2389 2390 2391 2392 2393 2394 |
if( zIpAddr ){
zBrowserCmd = mprintf("%s http://%s:%%d/ &", zBrowser, zIpAddr);
}else{
zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
}
if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY;
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
| < < | | 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 |
if( zIpAddr ){
zBrowserCmd = mprintf("%s http://%s:%%d/ &", zBrowser, zIpAddr);
}else{
zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
}
if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY;
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
}
db_close(1);
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
fossil_fatal("unable to listen on TCP socket %d", iPort);
}
g.sslNotAvailable = 1;
g.httpIn = stdin;
g.httpOut = stdout;
if( g.fHttpTrace || g.fSqlTrace ){
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
}
g.cgiOutput = 1;
find_server_repository(2, 0);
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
if( flags & HTTP_SERVER_SCGI ){
cgi_handle_scgi_request();
}else{
cgi_handle_http_request(0);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
|
| ︙ | ︙ |
Changes to src/makemake.tcl.
| ︙ | ︙ | |||
589 590 591 592 593 594 595 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2a OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
| ︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL | | | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL SSLDIR = $(B)\compat\openssl-1.0.2a SSLINCDIR = $(SSLDIR)\inc32 SSLLIBDIR = $(SSLDIR)\out32 SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... # BUGBUG (OpenSSL): Apparently, using "no-ssl*" here breaks the build. |
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
951 952 953 954 955 956 957 | db_open_repository(g.argv[2]); /* We should be done with options.. */ verify_all_options(); db_open_config(0); db_begin_transaction(); | | | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 |
db_open_repository(g.argv[2]);
/* We should be done with options.. */
verify_all_options();
db_open_config(0);
db_begin_transaction();
db_initial_setup(0, 0, 0);
fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]);
recon_read_dir(g.argv[3]);
fossil_print("\nBuilding the Fossil repository...\n");
rebuild_db(0, 1, 1);
reconstruct_private_table();
|
| ︙ | ︙ |
Changes to src/shell.c.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* ** If requested, include the SQLite compiler options file for MSVC. */ #if defined(INCLUDE_MSVC_H) #include "msvc.h" #endif /* ** Enable large-file support for fopen() and friends on unix. */ #ifndef SQLITE_DISABLE_LFS # define _LARGE_FILE 1 # ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 | > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* ** If requested, include the SQLite compiler options file for MSVC. */ #if defined(INCLUDE_MSVC_H) #include "msvc.h" #endif /* ** No support for loadable extensions in VxWorks. */ #if defined(_WRS_KERNEL) && !SQLITE_OMIT_LOAD_EXTENSION # define SQLITE_OMIT_LOAD_EXTENSION 1 #endif /* ** Enable large-file support for fopen() and friends on unix. */ #ifndef SQLITE_DISABLE_LFS # define _LARGE_FILE 1 # ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 |
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | #undef pclose #define pclose _pclose #else /* Make sure isatty() has a prototype. */ extern int isatty(int); | > | | | | > > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #undef pclose #define pclose _pclose #else /* Make sure isatty() has a prototype. */ extern int isatty(int); #if !defined(__RTP__) && !defined(_WRS_KERNEL) /* popen and pclose are not C89 functions and so are sometimes omitted from ** the <stdio.h> header */ extern FILE *popen(const char*,const char*); extern int pclose(FILE*); #else # define SQLITE_OMIT_POPEN 1 #endif #endif #if defined(_WIN32_WCE) /* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty() * thus we always assume that we have a console. That can be * overridden with the -batch command line option. */ |
| ︙ | ︙ | |||
161 162 163 164 165 166 167 |
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t;
}
| | < > > > > > > > > > | 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 |
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t;
}
#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
#include <sys/time.h>
#include <sys/resource.h>
/* VxWorks does not support getrusage() as far as we can determine */
#if defined(_WRS_KERNEL) || defined(__RTP__)
struct rusage {
struct timeval ru_utime; /* user CPU time used */
struct timeval ru_stime; /* system CPU time used */
};
#define getrusage(A,B) memset(B,0,sizeof(*B))
#endif
/* Saved resource information for the beginning of an operation */
static struct rusage sBegin; /* CPU time at start */
static sqlite3_int64 iBegin; /* Wall-clock time at start */
/*
** Begin timing an operation
|
| ︙ | ︙ | |||
191 192 193 194 195 196 197 |
}
/*
** Print the timing results.
*/
static void endTimer(void){
if( enableTimer ){
| < > | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
}
/*
** Print the timing results.
*/
static void endTimer(void){
if( enableTimer ){
sqlite3_int64 iEnd = timeOfDay();
struct rusage sEnd;
getrusage(RUSAGE_SELF, &sEnd);
printf("Run Time: real %.3f user %f sys %f\n",
(iEnd - iBegin)*0.001,
timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
}
}
|
| ︙ | ︙ | |||
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 |
}
/*
** Change the output file back to stdout
*/
static void output_reset(ShellState *p){
if( p->outfile[0]=='|' ){
pclose(p->out);
}else{
output_file_close(p->out);
}
p->outfile[0] = 0;
p->out = stdout;
}
| > > | 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 |
}
/*
** Change the output file back to stdout
*/
static void output_reset(ShellState *p){
if( p->outfile[0]=='|' ){
#ifndef SQLITE_OMIT_POPEN
pclose(p->out);
#endif
}else{
output_file_close(p->out);
}
p->outfile[0] = 0;
p->out = stdout;
}
|
| ︙ | ︙ | |||
2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 |
fprintf(stderr, "Error: multi-character row separators not allowed"
" for import\n");
return 1;
}
sCtx.zFile = zFile;
sCtx.nLine = 1;
if( sCtx.zFile[0]=='|' ){
sCtx.in = popen(sCtx.zFile+1, "r");
sCtx.zFile = "<pipe>";
xCloser = pclose;
}else{
sCtx.in = fopen(sCtx.zFile, "rb");
xCloser = fclose;
}
if( p->mode==MODE_Ascii ){
xRead = ascii_read_one_field;
}else{
| > > > > > | 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 |
fprintf(stderr, "Error: multi-character row separators not allowed"
" for import\n");
return 1;
}
sCtx.zFile = zFile;
sCtx.nLine = 1;
if( sCtx.zFile[0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
fprintf(stderr, "Error: pipes are not supporte in this OS\n");
return 1;
#else
sCtx.in = popen(sCtx.zFile+1, "r");
sCtx.zFile = "<pipe>";
xCloser = pclose;
#endif
}else{
sCtx.in = fopen(sCtx.zFile, "rb");
xCloser = fclose;
}
if( p->mode==MODE_Ascii ){
xRead = ascii_read_one_field;
}else{
|
| ︙ | ︙ | |||
3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 |
}
p->outCount = 2;
}else{
p->outCount = 0;
}
output_reset(p);
if( zFile[0]=='|' ){
p->out = popen(zFile + 1, "w");
if( p->out==0 ){
fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
p->out = stdout;
rc = 1;
}else{
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
}
}else{
p->out = output_file_open(zFile);
if( p->out==0 ){
if( strcmp(zFile,"off")!=0 ){
fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
}
p->out = stdout;
| > > > > > > | 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 |
}
p->outCount = 2;
}else{
p->outCount = 0;
}
output_reset(p);
if( zFile[0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
fprintf(stderr,"Error: pipes are not supported in this OS\n");
rc = 1;
p->out = stdout;
#else
p->out = popen(zFile + 1, "w");
if( p->out==0 ){
fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
p->out = stdout;
rc = 1;
}else{
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
}
#endif
}else{
p->out = output_file_open(zFile);
if( p->out==0 ){
if( strcmp(zFile,"off")!=0 ){
fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
}
p->out = stdout;
|
| ︙ | ︙ | |||
4185 4186 4187 4188 4189 4190 4191 | /* ** Read input from the file given by sqliterc_override. Or if that ** parameter is NULL, take input from ~/.sqliterc ** ** Returns the number of errors. */ | | < < | < > | | < | 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 |
/*
** Read input from the file given by sqliterc_override. Or if that
** parameter is NULL, take input from ~/.sqliterc
**
** Returns the number of errors.
*/
static void process_sqliterc(
ShellState *p, /* Configuration data */
const char *sqliterc_override /* Name of config file. NULL to use default */
){
char *home_dir = NULL;
const char *sqliterc = sqliterc_override;
char *zBuf = 0;
FILE *in = NULL;
if (sqliterc == NULL) {
home_dir = find_home_dir();
if( home_dir==0 ){
fprintf(stderr, "-- warning: cannot find home directory;"
" cannot read ~/.sqliterc\n");
return;
}
sqlite3_initialize();
zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
sqliterc = zBuf;
}
in = fopen(sqliterc,"rb");
if( in ){
if( stdin_is_interactive ){
fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
}
process_input(p,in);
fclose(in);
}
sqlite3_free(zBuf);
}
/*
** Show available command line options
*/
static const char zOptions[] =
" -ascii set output mode to 'ascii'\n"
|
| ︙ | ︙ | |||
4492 4493 4494 4495 4496 4497 4498 |
open_db(&data, 0);
}
/* Process the initialization file if there is one. If no -init option
** is given on the command line, look for a file named ~/.sqliterc and
** try to process it.
*/
| | < < < | 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 |
open_db(&data, 0);
}
/* Process the initialization file if there is one. If no -init option
** is given on the command line, look for a file named ~/.sqliterc and
** try to process it.
*/
process_sqliterc(&data,zInitFile);
/* Make a second pass through the command-line argument and set
** options. This second pass is delayed until after the initialization
** file is processed so that the command-line arguments will override
** settings in the initialization file.
*/
for(i=1; i<argc; i++){
|
| ︙ | ︙ |
Changes to src/sqlite3.c.
1 2 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite | | | 1 2 3 4 5 6 7 8 9 10 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.8.9. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% or more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other |
| ︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | #endif /* defined(_MSC_VER) */ #endif /* _MSVC_H_ */ /************** End of msvc.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* ** These #defines should enable >2GB file support on POSIX if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. ** ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any ** system #includes. Hence, this block of code must be the very first | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 127 128 129 130 131 132 133 134 135 136 137 | #endif /* defined(_MSC_VER) */ #endif /* _MSVC_H_ */ /************** End of msvc.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* ** Special setup for VxWorks */ /************** Include vxworks.h in the middle of sqliteInt.h ***************/ /************** Begin file vxworks.h *****************************************/ /* ** 2015-03-02 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to Wind River's VxWorks */ #if defined(__RTP__) || defined(_WRS_KERNEL) /* This is VxWorks. Set up things specially for that OS */ #include <vxWorks.h> #include <pthread.h> /* amalgamator: dontcache */ #define OS_VXWORKS 1 #define SQLITE_OS_OTHER 0 #define SQLITE_HOMEGROWN_RECURSIVE_MUTEX 1 #define SQLITE_OMIT_LOAD_EXTENSION 1 #define SQLITE_ENABLE_LOCKING_STYLE 0 #define HAVE_UTIME 1 #else /* This is not VxWorks. */ #define OS_VXWORKS 0 #endif /* defined(_WRS_KERNEL) */ /************** End of vxworks.h *********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* ** These #defines should enable >2GB file support on POSIX if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. ** ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any ** system #includes. Hence, this block of code must be the very first |
| ︙ | ︙ | |||
274 275 276 277 278 279 280 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.9" #define SQLITE_VERSION_NUMBER 3008009 #define SQLITE_SOURCE_ID "2015-03-09 10:40:48 e5da5e7d5dc5a3438ced23f1ee83e695abc29c45" /* ** 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 |
| ︙ | ︙ | |||
923 924 925 926 927 928 929 930 931 932 933 934 |
** CAPI3REF: Standard File Control Opcodes
** KEYWORDS: {file control opcodes} {file control opcode}
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
| > > | | | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
** CAPI3REF: Standard File Control Opcodes
** KEYWORDS: {file control opcodes} {file control opcode}
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** <ul>
** <li>[[SQLITE_FCNTL_LOCKSTATE]]
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
** is used during testing and is only available when the SQLITE_TEST
** compile-time option is used.
**
** <li>[[SQLITE_FCNTL_SIZE_HINT]]
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
** layer a hint of how large the database file will grow to be during the
** current transaction. This hint is not guaranteed to be accurate but it
** is often close. The underlying VFS might choose to preallocate database
** file space based on this hint in order to help writes to the database
** file run faster.
|
| ︙ | ︙ | |||
1055 1056 1057 1058 1059 1060 1061 | ** of the char** argument point to a string obtained from [sqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] ** file control returns [SQLITE_OK], then the parser assumes that the ** VFS has handled the PRAGMA itself and the parser generates a no-op | > > | | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | ** of the char** argument point to a string obtained from [sqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] ** file control returns [SQLITE_OK], then the parser assumes that the ** VFS has handled the PRAGMA itself and the parser generates a no-op ** prepared statement if result string is NULL, or that returns a copy ** of the result string if the string is non-NULL. ** ^If the [SQLITE_FCNTL_PRAGMA] file control returns ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means ** that the VFS encountered an error while handling the [PRAGMA] and the ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] ** file control occurs at the beginning of pragma statement analysis and so ** it is able to override built-in [PRAGMA] statements. ** ** <li>[[SQLITE_FCNTL_BUSYHANDLER]] |
| ︙ | ︙ | |||
1914 1915 1916 1917 1918 1919 1920 | ** ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value ** that specifies the maximum size of the created heap. | < | 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 | ** ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value ** that specifies the maximum size of the created heap. ** ** [[SQLITE_CONFIG_PCACHE_HDRSZ]] ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which ** is a pointer to an integer and writes into that integer the number of extra ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE]. ** The amount of extra space required can change depending on the compiler, |
| ︙ | ︙ | |||
3354 3355 3356 3357 3358 3359 3360 | ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** | | | | | < | | | | < | 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 | ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** ** ^If the nByte argument is negative, then zSql is read up to the ** first zero terminator. ^If nByte is positive, then it is the ** number of bytes read from zSql. ^If nByte is zero, then no prepared ** statement is generated. ** If the caller knows that the supplied string is nul-terminated, then ** there is a small performance advantage to passing an nByte parameter that ** is the number of bytes in the input string <i>including</i> ** the nul-terminator. ** ** ^If pzTail is not NULL then *pzTail is made to point to the first byte ** past the end of the first SQL statement in zSql. These routines only ** compile the first statement in zSql, so *pzTail is left pointing to ** what remains uncompiled. ** ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be |
| ︙ | ︙ | |||
4392 4393 4394 4395 4396 4397 4398 | /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid | | | | 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 | /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To encourage programmers to avoid ** these functions, we will not explain what they do. */ #ifndef SQLITE_OMIT_DEPRECATED SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); |
| ︙ | ︙ | |||
7155 7156 7157 7158 7159 7160 7161 | ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** | | > | | | | < < | | < | > > | | 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 | ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** ** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]] ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b> ** ** ^The sqlite3_backup_remaining() routine returns the number of pages still ** to be backed up at the conclusion of the most recent sqlite3_backup_step(). ** ^The sqlite3_backup_pagecount() routine returns the total number of pages ** in the source database at the conclusion of the most recent ** sqlite3_backup_step(). ** ^(The values returned by these functions are only updated by ** sqlite3_backup_step(). If the source database is modified in a way that ** changes the size of the source database or the number of pages remaining, ** those changes are not reflected in the output of sqlite3_backup_pagecount() ** and sqlite3_backup_remaining() until after the next ** sqlite3_backup_step().)^ ** ** <b>Concurrent Usage of Database Handles</b> ** ** ^The source [database connection] may be used by the application for other ** purposes while a backup operation is underway or being initialized. ** ^If SQLite is compiled and configured to support threadsafe database ** connections, then the source database connection may be used concurrently |
| ︙ | ︙ | |||
8016 8017 8018 8019 8020 8021 8022 | ** The maximum number of arguments to an SQL function. */ #ifndef SQLITE_MAX_FUNCTION_ARG # define SQLITE_MAX_FUNCTION_ARG 127 #endif /* | | | > > > > > < < < | 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 | ** The maximum number of arguments to an SQL function. */ #ifndef SQLITE_MAX_FUNCTION_ARG # define SQLITE_MAX_FUNCTION_ARG 127 #endif /* ** The suggested maximum number of in-memory pages to use for ** the main database table and for temporary tables. ** ** IMPLEMENTATION-OF: R-31093-59126 The default suggested cache size ** is 2000 pages. ** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be ** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. */ #ifndef SQLITE_DEFAULT_CACHE_SIZE # define SQLITE_DEFAULT_CACHE_SIZE 2000 #endif /* ** The default number of frames to accumulate in the log file before ** checkpointing the database in WAL mode. */ #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000 |
| ︙ | ︙ | |||
9731 9732 9733 9734 9735 9736 9737 | #define OP_Param 132 #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ #define OP_FkCounter 134 /* synopsis: fkctr[P1]+=P2 */ #define OP_FkIfZero 135 /* synopsis: if fkctr[P1]==0 goto P2 */ #define OP_MemMax 136 /* synopsis: r[P1]=max(r[P1],r[P2]) */ #define OP_IfPos 137 /* synopsis: if r[P1]>0 goto P2 */ #define OP_IfNeg 138 /* synopsis: r[P1]+=P3, if r[P1]<0 goto P2 */ | | > > | | | | | | | | | | | | | | | | | 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 | #define OP_Param 132 #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ #define OP_FkCounter 134 /* synopsis: fkctr[P1]+=P2 */ #define OP_FkIfZero 135 /* synopsis: if fkctr[P1]==0 goto P2 */ #define OP_MemMax 136 /* synopsis: r[P1]=max(r[P1],r[P2]) */ #define OP_IfPos 137 /* synopsis: if r[P1]>0 goto P2 */ #define OP_IfNeg 138 /* synopsis: r[P1]+=P3, if r[P1]<0 goto P2 */ #define OP_IfNotZero 139 /* synopsis: if r[P1]!=0 then r[P1]+=P3, goto P2 */ #define OP_DecrJumpZero 140 /* synopsis: if (--r[P1])==0 goto P2 */ #define OP_JumpZeroIncr 141 /* synopsis: if (r[P1]++)==0 ) goto P2 */ #define OP_AggFinal 142 /* synopsis: accum=r[P1] N=P2 */ #define OP_IncrVacuum 143 #define OP_Expire 144 #define OP_TableLock 145 /* synopsis: iDb=P1 root=P2 write=P3 */ #define OP_VBegin 146 #define OP_VCreate 147 #define OP_VDestroy 148 #define OP_VOpen 149 #define OP_VColumn 150 /* synopsis: r[P3]=vcolumn(P2) */ #define OP_VNext 151 #define OP_VRename 152 #define OP_Pagecount 153 #define OP_MaxPgcnt 154 #define OP_Init 155 /* synopsis: Start at P2 */ #define OP_Noop 156 #define OP_Explain 157 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c ** are encoded into bitvectors as follows: */ #define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */ |
| ︙ | ︙ | |||
9779 9780 9781 9782 9783 9784 9785 | /* 80 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x4c, 0x4c, 0x4c,\ /* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00,\ /* 96 */ 0x24, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\ /* 104 */ 0x00, 0x01, 0x01, 0x01, 0x01, 0x08, 0x08, 0x00,\ /* 112 */ 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00,\ /* 120 */ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 128 */ 0x0c, 0x45, 0x15, 0x01, 0x02, 0x02, 0x00, 0x01,\ | | | | | 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 | /* 80 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x4c, 0x4c, 0x4c,\ /* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00,\ /* 96 */ 0x24, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\ /* 104 */ 0x00, 0x01, 0x01, 0x01, 0x01, 0x08, 0x08, 0x00,\ /* 112 */ 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00,\ /* 120 */ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 128 */ 0x0c, 0x45, 0x15, 0x01, 0x02, 0x02, 0x00, 0x01,\ /* 136 */ 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x01,\ /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\ /* 152 */ 0x00, 0x02, 0x02, 0x01, 0x00, 0x00,} /************** End of opcodes.h *********************************************/ /************** Continuing where we left off in vdbe.h ***********************/ /* ** Prototypes for the VDBE interface. See comments on the implementation ** for a description of what each of these routines does. |
| ︙ | ︙ | |||
12020 12021 12022 12023 12024 12025 12026 | #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ #define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ #define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ #define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ #define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ | | | 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 | #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ #define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ #define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ #define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ #define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ #define WHERE_NO_AUTOINDEX 0x0080 /* Disallow automatic indexes */ #define WHERE_GROUPBY 0x0100 /* pOrderBy is really a GROUP BY */ #define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */ #define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ #define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */ #define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */ /* Allowed return values from sqlite3WhereIsDistinct() |
| ︙ | ︙ | |||
24967 24968 24969 24970 24971 24972 24973 |
/* 132 */ "Param" OpHelp(""),
/* 133 */ "Real" OpHelp("r[P2]=P4"),
/* 134 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
/* 135 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
/* 136 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
/* 137 */ "IfPos" OpHelp("if r[P1]>0 goto P2"),
/* 138 */ "IfNeg" OpHelp("r[P1]+=P3, if r[P1]<0 goto P2"),
| > | > | | | | | | | | | | | | | | | | | 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 |
/* 132 */ "Param" OpHelp(""),
/* 133 */ "Real" OpHelp("r[P2]=P4"),
/* 134 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
/* 135 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
/* 136 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
/* 137 */ "IfPos" OpHelp("if r[P1]>0 goto P2"),
/* 138 */ "IfNeg" OpHelp("r[P1]+=P3, if r[P1]<0 goto P2"),
/* 139 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]+=P3, goto P2"),
/* 140 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
/* 141 */ "JumpZeroIncr" OpHelp("if (r[P1]++)==0 ) goto P2"),
/* 142 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
/* 143 */ "IncrVacuum" OpHelp(""),
/* 144 */ "Expire" OpHelp(""),
/* 145 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
/* 146 */ "VBegin" OpHelp(""),
/* 147 */ "VCreate" OpHelp(""),
/* 148 */ "VDestroy" OpHelp(""),
/* 149 */ "VOpen" OpHelp(""),
/* 150 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
/* 151 */ "VNext" OpHelp(""),
/* 152 */ "VRename" OpHelp(""),
/* 153 */ "Pagecount" OpHelp(""),
/* 154 */ "MaxPgcnt" OpHelp(""),
/* 155 */ "Init" OpHelp("Start at P2"),
/* 156 */ "Noop" OpHelp(""),
/* 157 */ "Explain" OpHelp(""),
};
return azName[i];
}
#endif
/************** End of opcodes.c *********************************************/
/************** Begin file os_unix.c *****************************************/
|
| ︙ | ︙ | |||
25063 25064 25065 25066 25067 25068 25069 | # if defined(__APPLE__) # define SQLITE_ENABLE_LOCKING_STYLE 1 # else # define SQLITE_ENABLE_LOCKING_STYLE 0 # endif #endif | < < < < < < < < < < < < | > > > > | > | | < < < | < | | 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 | # if defined(__APPLE__) # define SQLITE_ENABLE_LOCKING_STYLE 1 # else # define SQLITE_ENABLE_LOCKING_STYLE 0 # endif #endif /* ** standard include files. */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> /* #include <time.h> */ #include <sys/time.h> #include <errno.h> #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 # include <sys/mman.h> #endif #if SQLITE_ENABLE_LOCKING_STYLE # include <sys/ioctl.h> # include <sys/file.h> # include <sys/param.h> #endif /* SQLITE_ENABLE_LOCKING_STYLE */ #if OS_VXWORKS /* # include <sys/ioctl.h> */ # include <semaphore.h> # include <limits.h> #endif /* OS_VXWORKS */ #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE # include <sys/mount.h> #endif #ifdef HAVE_UTIME # include <utime.h> #endif |
| ︙ | ︙ | |||
25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 | # define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755 #endif /* ** Maximum supported path-length. */ #define MAX_PATHNAME 512 /* ** Only set the lastErrno if the error code is a real error and not ** a normal expected return code of SQLITE_BUSY or SQLITE_OK */ #define IS_LOCK_ERROR(x) ((x != SQLITE_OK) && (x != SQLITE_BUSY)) | > > > > | 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 | # define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755 #endif /* ** Maximum supported path-length. */ #define MAX_PATHNAME 512 /* Always cast the getpid() return type for compatibility with ** kernel modules in VxWorks. */ #define osGetpid(X) (pid_t)getpid() /* ** Only set the lastErrno if the error code is a real error and not ** a normal expected return code of SQLITE_BUSY or SQLITE_OK */ #define IS_LOCK_ERROR(x) ((x != SQLITE_OK) && (x != SQLITE_BUSY)) |
| ︙ | ︙ | |||
25229 25230 25231 25232 25233 25234 25235 | #endif }; /* This variable holds the process id (pid) from when the xRandomness() ** method was called. If xOpen() is called from a different process id, ** indicating that a fork() has occurred, the PRNG will be reset. */ | | | 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 | #endif }; /* This variable holds the process id (pid) from when the xRandomness() ** method was called. If xOpen() is called from a different process id, ** indicating that a fork() has occurred, the PRNG will be reset. */ static pid_t randomnessPid = 0; /* ** Allowed values for the unixFile.ctrlFlags bitmask: */ #define UNIXFILE_EXCL 0x01 /* Connections from one process only */ #define UNIXFILE_RDONLY 0x02 /* Connection is read only */ #define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ |
| ︙ | ︙ | |||
25585 25586 25587 25588 25589 25590 25591 |
{ "fcntl", (sqlite3_syscall_ptr)fcntl, 0 },
#define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent)
{ "read", (sqlite3_syscall_ptr)read, 0 },
#define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)
| | | | 25623 25624 25625 25626 25627 25628 25629 25630 25631 25632 25633 25634 25635 25636 25637 25638 25639 25640 25641 25642 25643 25644 25645 25646 25647 25648 25649 25650 25651 25652 25653 25654 |
{ "fcntl", (sqlite3_syscall_ptr)fcntl, 0 },
#define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent)
{ "read", (sqlite3_syscall_ptr)read, 0 },
#define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)
#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
{ "pread", (sqlite3_syscall_ptr)pread, 0 },
#else
{ "pread", (sqlite3_syscall_ptr)0, 0 },
#endif
#define osPread ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent)
#if defined(USE_PREAD64)
{ "pread64", (sqlite3_syscall_ptr)pread64, 0 },
#else
{ "pread64", (sqlite3_syscall_ptr)0, 0 },
#endif
#define osPread64 ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent)
{ "write", (sqlite3_syscall_ptr)write, 0 },
#define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
{ "pwrite", (sqlite3_syscall_ptr)pwrite, 0 },
#else
{ "pwrite", (sqlite3_syscall_ptr)0, 0 },
#endif
#define osPwrite ((ssize_t(*)(int,const void*,size_t,off_t))\
aSyscall[12].pCurrent)
|
| ︙ | ︙ | |||
26741 26742 26743 26744 26745 26746 26747 |
unixInodeInfo *pInode;
struct flock lock;
int tErrno = 0;
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
| | > | 26779 26780 26781 26782 26783 26784 26785 26786 26787 26788 26789 26790 26791 26792 26793 26794 |
unixInodeInfo *pInode;
struct flock lock;
int tErrno = 0;
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared,
osGetpid()));
/* If there is already a lock of this type or more restrictive on the
** unixFile, do nothing. Don't use the end_lock: exit path, as
** unixEnterMutex() hasn't been called yet.
*/
if( pFile->eFileLock>=eFileLock ){
OSTRACE(("LOCK %d %s ok (already held) (unix)\n", pFile->h,
|
| ︙ | ︙ | |||
26949 26950 26951 26952 26953 26954 26955 |
unixInodeInfo *pInode;
struct flock lock;
int rc = SQLITE_OK;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
| | | 26988 26989 26990 26991 26992 26993 26994 26995 26996 26997 26998 26999 27000 27001 27002 |
unixInodeInfo *pInode;
struct flock lock;
int rc = SQLITE_OK;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
osGetpid()));
assert( eFileLock<=SHARED_LOCK );
if( pFile->eFileLock<=eFileLock ){
return SQLITE_OK;
}
unixEnterMutex();
pInode = pFile->pInode;
|
| ︙ | ︙ | |||
27376 27377 27378 27379 27380 27381 27382 |
static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
char *zLockFile = (char *)pFile->lockingContext;
int rc;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
| | | 27415 27416 27417 27418 27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 |
static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
char *zLockFile = (char *)pFile->lockingContext;
int rc;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
if( pFile->eFileLock==eFileLock ){
return SQLITE_OK;
}
|
| ︙ | ︙ | |||
27439 27440 27441 27442 27443 27444 27445 | ** flock() locking is like dot-file locking in that the various ** fine-grain locking levels supported by SQLite are collapsed into ** a single exclusive lock. In other words, SHARED, RESERVED, and ** PENDING locks are the same thing as an EXCLUSIVE lock. SQLite ** still works when you do this, but concurrency is reduced since ** only a single process can be reading the database at a time. ** | | < | | 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 27488 27489 27490 27491 27492 27493 27494 |
** flock() locking is like dot-file locking in that the various
** fine-grain locking levels supported by SQLite are collapsed into
** a single exclusive lock. In other words, SHARED, RESERVED, and
** PENDING locks are the same thing as an EXCLUSIVE lock. SQLite
** still works when you do this, but concurrency is reduced since
** only a single process can be reading the database at a time.
**
** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off
*/
#if SQLITE_ENABLE_LOCKING_STYLE
/*
** Retry flock() calls that fail with EINTR
*/
#ifdef EINTR
static int robust_flock(int fd, int op){
int rc;
|
| ︙ | ︙ | |||
27595 27596 27597 27598 27599 27600 27601 |
** the requested locking level, this routine is a no-op.
*/
static int flockUnlock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock,
| | | 27633 27634 27635 27636 27637 27638 27639 27640 27641 27642 27643 27644 27645 27646 27647 |
** the requested locking level, this routine is a no-op.
*/
static int flockUnlock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock,
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
if( pFile->eFileLock==eFileLock ){
return SQLITE_OK;
}
|
| ︙ | ︙ | |||
27656 27657 27658 27659 27660 27661 27662 | /* ** This routine checks if there is a RESERVED lock held on the specified ** file by this or any other process. If such a lock is held, set *pResOut ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ | | | 27694 27695 27696 27697 27698 27699 27700 27701 27702 27703 27704 27705 27706 27707 27708 |
/*
** This routine checks if there is a RESERVED lock held on the specified
** file by this or any other process. If such a lock is held, set *pResOut
** to a non-zero value otherwise *pResOut is set to zero. The return value
** is set to SQLITE_OK unless an I/O error occurs during lock checking.
*/
static int semXCheckReservedLock(sqlite3_file *id, int *pResOut) {
int rc = SQLITE_OK;
int reserved = 0;
unixFile *pFile = (unixFile*)id;
SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
assert( pFile );
|
| ︙ | ︙ | |||
27723 27724 27725 27726 27727 27728 27729 | ** lock states in the sqlite3_file structure, but all locks SHARED or ** above are really EXCLUSIVE locks and exclude all other processes from ** access the file. ** ** This routine will only increase a lock. Use the sqlite3OsUnlock() ** routine to lower a locking level. */ | | | 27761 27762 27763 27764 27765 27766 27767 27768 27769 27770 27771 27772 27773 27774 27775 |
** lock states in the sqlite3_file structure, but all locks SHARED or
** above are really EXCLUSIVE locks and exclude all other processes from
** access the file.
**
** This routine will only increase a lock. Use the sqlite3OsUnlock()
** routine to lower a locking level.
*/
static int semXLock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
sem_t *pSem = pFile->pInode->pSem;
int rc = SQLITE_OK;
/* if we already have a lock, it is exclusive.
** Just adjust level and punt on outta here. */
if (pFile->eFileLock > NO_LOCK) {
|
| ︙ | ︙ | |||
27756 27757 27758 27759 27760 27761 27762 | /* ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock ** must be either NO_LOCK or SHARED_LOCK. ** ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ | | | | 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 |
/*
** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
*/
static int semXUnlock(sqlite3_file *id, int eFileLock) {
unixFile *pFile = (unixFile*)id;
sem_t *pSem = pFile->pInode->pSem;
assert( pFile );
assert( pSem );
OSTRACE(("UNLOCK %d %d was %d pid=%d (sem)\n", pFile->h, eFileLock,
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
if( pFile->eFileLock==eFileLock ){
return SQLITE_OK;
}
|
| ︙ | ︙ | |||
27793 27794 27795 27796 27797 27798 27799 | pFile->eFileLock = NO_LOCK; return SQLITE_OK; } /* ** Close a file. */ | | | | 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 27847 27848 |
pFile->eFileLock = NO_LOCK;
return SQLITE_OK;
}
/*
** Close a file.
*/
static int semXClose(sqlite3_file *id) {
if( id ){
unixFile *pFile = (unixFile*)id;
semXUnlock(id, NO_LOCK);
assert( pFile );
unixEnterMutex();
releaseInodeInfo(pFile);
unixLeaveMutex();
closeUnixFile(id);
}
return SQLITE_OK;
|
| ︙ | ︙ | |||
27977 27978 27979 27980 27981 27982 27983 |
unixFile *pFile = (unixFile*)id;
unixInodeInfo *pInode = pFile->pInode;
afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
| | | 28015 28016 28017 28018 28019 28020 28021 28022 28023 28024 28025 28026 28027 28028 28029 |
unixFile *pFile = (unixFile*)id;
unixInodeInfo *pInode = pFile->pInode;
afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
azFileLock(pInode->eFileLock), pInode->nShared , osGetpid()));
/* If there is already a lock of this type or more restrictive on the
** unixFile, do nothing. Don't use the afp_end_lock: exit path, as
** unixEnterMutex() hasn't been called yet.
*/
if( pFile->eFileLock>=eFileLock ){
OSTRACE(("LOCK %d %s ok (already held) (afp)\n", pFile->h,
|
| ︙ | ︙ | |||
28163 28164 28165 28166 28167 28168 28169 |
#ifdef SQLITE_TEST
int h = pFile->h;
#endif
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
| | | 28201 28202 28203 28204 28205 28206 28207 28208 28209 28210 28211 28212 28213 28214 28215 |
#ifdef SQLITE_TEST
int h = pFile->h;
#endif
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
osGetpid()));
assert( eFileLock<=SHARED_LOCK );
if( pFile->eFileLock<=eFileLock ){
return SQLITE_OK;
}
unixEnterMutex();
pInode = pFile->pInode;
|
| ︙ | ︙ | |||
29202 29203 29204 29205 29206 29207 29208 |
/*
** Return the system page size.
**
** This function should not be called directly by other code in this file.
** Instead, it should be called via macro osGetpagesize().
*/
static int unixGetpagesize(void){
| > > | | 29240 29241 29242 29243 29244 29245 29246 29247 29248 29249 29250 29251 29252 29253 29254 29255 29256 |
/*
** Return the system page size.
**
** This function should not be called directly by other code in this file.
** Instead, it should be called via macro osGetpagesize().
*/
static int unixGetpagesize(void){
#if OS_VXWORKS
return 1024;
#elif defined(_BSD_SOURCE)
return getpagesize();
#else
return (int)sysconf(_SC_PAGESIZE);
#endif
}
#endif /* !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 */
|
| ︙ | ︙ | |||
29831 29832 29833 29834 29835 29836 29837 |
assert( (p->sharedMask & mask)==0 );
p->exclMask |= mask;
}
}
}
sqlite3_mutex_leave(pShmNode->mutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
| | | 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 29882 29883 29884 29885 |
assert( (p->sharedMask & mask)==0 );
p->exclMask |= mask;
}
}
}
sqlite3_mutex_leave(pShmNode->mutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
p->id, osGetpid(), p->sharedMask, p->exclMask));
return rc;
}
/*
** Implement a memory barrier or memory fence on shared memory.
**
** All loads and stores begun before the barrier must complete before
|
| ︙ | ︙ | |||
30234 30235 30236 30237 30238 30239 30240 | dotlockClose, /* xClose method */ dotlockLock, /* xLock method */ dotlockUnlock, /* xUnlock method */ dotlockCheckReservedLock, /* xCheckReservedLock method */ 0 /* xShmMap method */ ) | | | | | | | 30274 30275 30276 30277 30278 30279 30280 30281 30282 30283 30284 30285 30286 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 30309 | dotlockClose, /* xClose method */ dotlockLock, /* xLock method */ dotlockUnlock, /* xUnlock method */ dotlockCheckReservedLock, /* xCheckReservedLock method */ 0 /* xShmMap method */ ) #if SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( flockIoFinder, /* Finder function name */ flockIoMethods, /* sqlite3_io_methods object name */ 1, /* shared memory is disabled */ flockClose, /* xClose method */ flockLock, /* xLock method */ flockUnlock, /* xUnlock method */ flockCheckReservedLock, /* xCheckReservedLock method */ 0 /* xShmMap method */ ) #endif #if OS_VXWORKS IOMETHODS( semIoFinder, /* Finder function name */ semIoMethods, /* sqlite3_io_methods object name */ 1, /* shared memory is disabled */ semXClose, /* xClose method */ semXLock, /* xLock method */ semXUnlock, /* xUnlock method */ semXCheckReservedLock, /* xCheckReservedLock method */ 0 /* xShmMap method */ ) #endif #if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( afpIoFinder, /* Finder function name */ |
| ︙ | ︙ | |||
30379 30380 30381 30382 30383 30384 30385 | } } static const sqlite3_io_methods *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl; #endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ | | | | | | < < | | 30419 30420 30421 30422 30423 30424 30425 30426 30427 30428 30429 30430 30431 30432 30433 30434 30435 30436 30437 30438 30439 |
}
}
static const sqlite3_io_methods
*(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;
#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
#if OS_VXWORKS
/*
** This "finder" function for VxWorks checks to see if posix advisory
** locking works. If it does, then that is what is used. If it does not
** work, then fallback to named semaphore locking.
*/
static const sqlite3_io_methods *vxworksIoFinderImpl(
const char *filePath, /* name of the database file */
unixFile *pNew /* the open file object */
){
struct flock lockInfo;
if( !filePath ){
/* If filePath==NULL that means we are dealing with a transient file
|
| ︙ | ︙ | |||
30413 30414 30415 30416 30417 30418 30419 |
if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
return &posixIoMethods;
}else{
return &semIoMethods;
}
}
static const sqlite3_io_methods
| | | | 30451 30452 30453 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 |
if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
return &posixIoMethods;
}else{
return &semIoMethods;
}
}
static const sqlite3_io_methods
*(*const vxworksIoFinder)(const char*,unixFile*) = vxworksIoFinderImpl;
#endif /* OS_VXWORKS */
/*
** An abstract type for a pointer to an IO method finder function:
*/
typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);
|
| ︙ | ︙ | |||
30928 30929 30930 30931 30932 30933 30934 | ); /* Detect a pid change and reset the PRNG. There is a race condition ** here such that two or more threads all trying to open databases at ** the same instant might all reset the PRNG. But multiple resets ** are harmless. */ | | | | 30966 30967 30968 30969 30970 30971 30972 30973 30974 30975 30976 30977 30978 30979 30980 30981 |
);
/* Detect a pid change and reset the PRNG. There is a race condition
** here such that two or more threads all trying to open databases at
** the same instant might all reset the PRNG. But multiple resets
** are harmless.
*/
if( randomnessPid!=osGetpid() ){
randomnessPid = osGetpid();
sqlite3_randomness(0,0);
}
memset(p, 0, sizeof(unixFile));
if( eType==SQLITE_OPEN_MAIN_DB ){
UnixUnusedFd *pUnused;
|
| ︙ | ︙ | |||
31320 31321 31322 31323 31324 31325 31326 | ** in the random seed. ** ** When testing, initializing zBuf[] to zero is all we do. That means ** that we always use the same random number sequence. This makes the ** tests repeatable. */ memset(zBuf, 0, nBuf); | | | 31358 31359 31360 31361 31362 31363 31364 31365 31366 31367 31368 31369 31370 31371 31372 |
** in the random seed.
**
** When testing, initializing zBuf[] to zero is all we do. That means
** that we always use the same random number sequence. This makes the
** tests repeatable.
*/
memset(zBuf, 0, nBuf);
randomnessPid = osGetpid();
#if !defined(SQLITE_TEST)
{
int fd, got;
fd = robust_open("/dev/urandom", O_RDONLY, 0);
if( fd<0 ){
time_t t;
time(&t);
|
| ︙ | ︙ | |||
31641 31642 31643 31644 31645 31646 31647 |
#ifdef LOCKPROXYDIR
len = strlcpy(lPath, LOCKPROXYDIR, maxLen);
#else
# ifdef _CS_DARWIN_USER_TEMP_DIR
{
if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){
OSTRACE(("GETLOCKPATH failed %s errno=%d pid=%d\n",
| | | 31679 31680 31681 31682 31683 31684 31685 31686 31687 31688 31689 31690 31691 31692 31693 |
#ifdef LOCKPROXYDIR
len = strlcpy(lPath, LOCKPROXYDIR, maxLen);
#else
# ifdef _CS_DARWIN_USER_TEMP_DIR
{
if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){
OSTRACE(("GETLOCKPATH failed %s errno=%d pid=%d\n",
lPath, errno, osGetpid()));
return SQLITE_IOERR_LOCK;
}
len = strlcat(lPath, "sqliteplocks", maxLen);
}
# else
len = strlcpy(lPath, "/tmp/", maxLen);
# endif
|
| ︙ | ︙ | |||
31663 31664 31665 31666 31667 31668 31669 |
dbLen = (int)strlen(dbPath);
for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){
char c = dbPath[i];
lPath[i+len] = (c=='/')?'_':c;
}
lPath[i+len]='\0';
strlcat(lPath, ":auto:", maxLen);
| | | 31701 31702 31703 31704 31705 31706 31707 31708 31709 31710 31711 31712 31713 31714 31715 |
dbLen = (int)strlen(dbPath);
for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){
char c = dbPath[i];
lPath[i+len] = (c=='/')?'_':c;
}
lPath[i+len]='\0';
strlcat(lPath, ":auto:", maxLen);
OSTRACE(("GETLOCKPATH proxy lock path=%s pid=%d\n", lPath, osGetpid()));
return SQLITE_OK;
}
/*
** Creates the lock file and any missing directories in lockPath
*/
static int proxyCreateLockPath(const char *lockPath){
|
| ︙ | ︙ | |||
31690 31691 31692 31693 31694 31695 31696 |
|| (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){
buf[i]='\0';
if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){
int err=errno;
if( err!=EEXIST ) {
OSTRACE(("CREATELOCKPATH FAILED creating %s, "
"'%s' proxy lock path=%s pid=%d\n",
| | | | 31728 31729 31730 31731 31732 31733 31734 31735 31736 31737 31738 31739 31740 31741 31742 31743 31744 31745 31746 31747 31748 31749 31750 31751 |
|| (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){
buf[i]='\0';
if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){
int err=errno;
if( err!=EEXIST ) {
OSTRACE(("CREATELOCKPATH FAILED creating %s, "
"'%s' proxy lock path=%s pid=%d\n",
buf, strerror(err), lockPath, osGetpid()));
return err;
}
}
}
start=i+1;
}
buf[i] = lockPath[i];
}
OSTRACE(("CREATELOCKPATH proxy lock path=%s pid=%d\n", lockPath, osGetpid()));
return 0;
}
/*
** Create a new VFS file descriptor (stored in memory obtained from
** sqlite3_malloc) and open the file named "path" in the file descriptor.
**
|
| ︙ | ︙ | |||
32004 32005 32006 32007 32008 32009 32010 |
int createConch = 0;
int hostIdMatch = 0;
int readLen = 0;
int tryOldLockPath = 0;
int forceNewLockPath = 0;
OSTRACE(("TAKECONCH %d for %s pid=%d\n", conchFile->h,
| | > | 32042 32043 32044 32045 32046 32047 32048 32049 32050 32051 32052 32053 32054 32055 32056 32057 |
int createConch = 0;
int hostIdMatch = 0;
int readLen = 0;
int tryOldLockPath = 0;
int forceNewLockPath = 0;
OSTRACE(("TAKECONCH %d for %s pid=%d\n", conchFile->h,
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
osGetpid()));
rc = proxyGetHostID(myHostID, &pError);
if( (rc&0xff)==SQLITE_IOERR ){
storeLastErrno(pFile, pError);
goto end_takeconch;
}
rc = proxyConchLock(pFile, myHostID, SHARED_LOCK);
|
| ︙ | ︙ | |||
32214 32215 32216 32217 32218 32219 32220 |
proxyLockingContext *pCtx; /* The locking context for the proxy lock */
unixFile *conchFile; /* Name of the conch file */
pCtx = (proxyLockingContext *)pFile->lockingContext;
conchFile = pCtx->conchFile;
OSTRACE(("RELEASECONCH %d for %s pid=%d\n", conchFile->h,
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
| | | 32253 32254 32255 32256 32257 32258 32259 32260 32261 32262 32263 32264 32265 32266 32267 |
proxyLockingContext *pCtx; /* The locking context for the proxy lock */
unixFile *conchFile; /* Name of the conch file */
pCtx = (proxyLockingContext *)pFile->lockingContext;
conchFile = pCtx->conchFile;
OSTRACE(("RELEASECONCH %d for %s pid=%d\n", conchFile->h,
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
osGetpid()));
if( pCtx->conchHeld>0 ){
rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);
}
pCtx->conchHeld = 0;
OSTRACE(("RELEASECONCH %d %s\n", conchFile->h,
(rc==SQLITE_OK ? "ok" : "failed")));
return rc;
|
| ︙ | ︙ | |||
32356 32357 32358 32359 32360 32361 32362 |
if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ){
lockPath=NULL;
}else{
lockPath=(char *)path;
}
OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h,
| | | 32395 32396 32397 32398 32399 32400 32401 32402 32403 32404 32405 32406 32407 32408 32409 |
if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ){
lockPath=NULL;
}else{
lockPath=(char *)path;
}
OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h,
(lockPath ? lockPath : ":auto:"), osGetpid()));
pCtx = sqlite3_malloc( sizeof(*pCtx) );
if( pCtx==0 ){
return SQLITE_NOMEM;
}
memset(pCtx, 0, sizeof(*pCtx));
|
| ︙ | ︙ | |||
32697 32698 32699 32700 32701 32702 32703 |
** All default VFSes for unix are contained in the following array.
**
** Note that the sqlite3_vfs.pNext field of the VFS object is modified
** by the SQLite core when the VFS is registered. So the following
** array cannot be const.
*/
static sqlite3_vfs aVfs[] = {
| | > > | > | < | 32736 32737 32738 32739 32740 32741 32742 32743 32744 32745 32746 32747 32748 32749 32750 32751 32752 32753 32754 32755 32756 32757 32758 32759 32760 32761 32762 32763 32764 32765 32766 32767 |
** All default VFSes for unix are contained in the following array.
**
** Note that the sqlite3_vfs.pNext field of the VFS object is modified
** by the SQLite core when the VFS is registered. So the following
** array cannot be const.
*/
static sqlite3_vfs aVfs[] = {
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
UNIXVFS("unix", autolockIoFinder ),
#elif OS_VXWORKS
UNIXVFS("unix", vxworksIoFinder ),
#else
UNIXVFS("unix", posixIoFinder ),
#endif
UNIXVFS("unix-none", nolockIoFinder ),
UNIXVFS("unix-dotfile", dotlockIoFinder ),
UNIXVFS("unix-excl", posixIoFinder ),
#if OS_VXWORKS
UNIXVFS("unix-namedsem", semIoFinder ),
#endif
#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS
UNIXVFS("unix-posix", posixIoFinder ),
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
UNIXVFS("unix-flock", flockIoFinder ),
#endif
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
UNIXVFS("unix-afp", afpIoFinder ),
UNIXVFS("unix-nfs", nfsIoFinder ),
UNIXVFS("unix-proxy", proxyIoFinder ),
#endif
};
|
| ︙ | ︙ | |||
39070 39071 39072 39073 39074 39075 39076 |
p->pCache->pPage1 = 0;
}
sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0);
}
}
/*
| | > > > > > > > > | 39111 39112 39113 39114 39115 39116 39117 39118 39119 39120 39121 39122 39123 39124 39125 39126 39127 39128 39129 39130 39131 39132 39133 39134 39135 39136 39137 39138 |
p->pCache->pPage1 = 0;
}
sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0);
}
}
/*
** Compute the number of pages of cache requested. p->szCache is the
** cache size requested by the "PRAGMA cache_size" statement.
**
**
*/
static int numberOfCachePages(PCache *p){
if( p->szCache>=0 ){
/* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the
** suggested cache size is set to N. */
return p->szCache;
}else{
/* IMPLEMENTATION-OF: R-61436-13639 If the argument N is negative, then
** the number of cache pages is adjusted to use approximately abs(N*1024)
** bytes of memory. */
return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));
}
}
/*************************************************** General Interfaces ******
**
** Initialize and shutdown the page cache subsystem. Neither of these
|
| ︙ | ︙ | |||
68613 68614 68615 68616 68617 68618 68619 68620 68621 68622 68623 68624 68625 68626 |
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16BE);
}
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16LE);
}
#endif /* SQLITE_OMIT_UTF16 */
SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
static const u8 aType[] = {
SQLITE_BLOB, /* 0x00 */
SQLITE_NULL, /* 0x01 */
SQLITE_TEXT, /* 0x02 */
SQLITE_NULL, /* 0x03 */
SQLITE_INTEGER, /* 0x04 */
| > > > > | 68662 68663 68664 68665 68666 68667 68668 68669 68670 68671 68672 68673 68674 68675 68676 68677 68678 68679 |
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16BE);
}
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){
return sqlite3ValueText(pVal, SQLITE_UTF16LE);
}
#endif /* SQLITE_OMIT_UTF16 */
/* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
** point number string BLOB NULL
*/
SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
static const u8 aType[] = {
SQLITE_BLOB, /* 0x00 */
SQLITE_NULL, /* 0x01 */
SQLITE_TEXT, /* 0x02 */
SQLITE_NULL, /* 0x03 */
SQLITE_INTEGER, /* 0x04 */
|
| ︙ | ︙ | |||
71288 71289 71290 71291 71292 71293 71294 | } #endif /* Opcode: String8 * P2 * P4 * ** Synopsis: r[P2]='P4' ** ** P4 points to a nul terminated UTF-8 string. This opcode is transformed | | | 71341 71342 71343 71344 71345 71346 71347 71348 71349 71350 71351 71352 71353 71354 71355 |
}
#endif
/* Opcode: String8 * P2 * P4 *
** Synopsis: r[P2]='P4'
**
** P4 points to a nul terminated UTF-8 string. This opcode is transformed
** into a String opcode before it is executed for the first time. During
** this transformation, the length of string P4 is computed and stored
** as the P1 parameter.
*/
case OP_String8: { /* same as TK_STRING, out2-prerelease */
assert( pOp->p4.z!=0 );
pOp->opcode = OP_String;
pOp->p1 = sqlite3Strlen30(pOp->p4.z);
|
| ︙ | ︙ | |||
71320 71321 71322 71323 71324 71325 71326 |
#endif
if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
goto too_big;
}
/* Fall through to the next case, OP_String */
}
| | > > > > > > > > > > > > | 71373 71374 71375 71376 71377 71378 71379 71380 71381 71382 71383 71384 71385 71386 71387 71388 71389 71390 71391 71392 71393 71394 71395 71396 71397 71398 71399 71400 71401 71402 71403 71404 71405 71406 71407 71408 71409 71410 |
#endif
if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
goto too_big;
}
/* Fall through to the next case, OP_String */
}
/* Opcode: String P1 P2 P3 P4 P5
** Synopsis: r[P2]='P4' (len=P1)
**
** The string value P4 of length P1 (bytes) is stored in register P2.
**
** If P5!=0 and the content of register P3 is greater than zero, then
** the datatype of the register P2 is converted to BLOB. The content is
** the same sequence of bytes, it is merely interpreted as a BLOB instead
** of a string, as if it had been CAST.
*/
case OP_String: { /* out2-prerelease */
assert( pOp->p4.z!=0 );
pOut->flags = MEM_Str|MEM_Static|MEM_Term;
pOut->z = pOp->p4.z;
pOut->n = pOp->p1;
pOut->enc = encoding;
UPDATE_MAX_BLOBSIZE(pOut);
if( pOp->p5 ){
assert( pOp->p3>0 );
assert( pOp->p3<=(p->nMem-p->nCursor) );
pIn3 = &aMem[pOp->p3];
assert( pIn3->flags & MEM_Int );
if( pIn3->u.i ) pOut->flags = MEM_Blob|MEM_Static|MEM_Term;
}
break;
}
/* Opcode: Null P1 P2 P3 * *
** Synopsis: r[P2..P3]=NULL
**
** Write a NULL into registers P2. If P3 greater than P2, then also write
|
| ︙ | ︙ | |||
73323 73324 73325 73326 73327 73328 73329 |
/* Store the current value of the database handles deferred constraint
** counter. If the statement transaction needs to be rolled back,
** the value of this counter needs to be restored too. */
p->nStmtDefCons = db->nDeferredCons;
p->nStmtDefImmCons = db->nDeferredImmCons;
}
| | > > > > > | 73388 73389 73390 73391 73392 73393 73394 73395 73396 73397 73398 73399 73400 73401 73402 73403 73404 73405 73406 73407 |
/* Store the current value of the database handles deferred constraint
** counter. If the statement transaction needs to be rolled back,
** the value of this counter needs to be restored too. */
p->nStmtDefCons = db->nDeferredCons;
p->nStmtDefImmCons = db->nDeferredImmCons;
}
/* Gather the schema version number for checking:
** IMPLEMENTATION-OF: R-32195-19465 The schema version is used by SQLite
** each time a query is executed to ensure that the internal cache of the
** schema used when compiling the SQL query matches the schema of the
** database against which the compiled query is actually executed.
*/
sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&iMeta);
iGen = db->aDb[pOp->p1].pSchema->iGeneration;
}else{
iGen = iMeta = 0;
}
assert( pOp->p5==0 || pOp->p4type==P4_INT32 );
if( pOp->p5 && (iMeta!=pOp->p3 || iGen!=pOp->p4.i) ){
|
| ︙ | ︙ | |||
75841 75842 75843 75844 75845 75846 75847 | break; } #endif /* SQLITE_OMIT_AUTOINCREMENT */ /* Opcode: IfPos P1 P2 * * * ** Synopsis: if r[P1]>0 goto P2 ** | > | > | < > | 75911 75912 75913 75914 75915 75916 75917 75918 75919 75920 75921 75922 75923 75924 75925 75926 75927 75928 75929 75930 |
break;
}
#endif /* SQLITE_OMIT_AUTOINCREMENT */
/* Opcode: IfPos P1 P2 * * *
** Synopsis: if r[P1]>0 goto P2
**
** Register P1 must contain an integer.
** If the value of register P1 is 1 or greater, jump to P2 and
** add the literal value P3 to register P1.
**
** If the initial value of register P1 is less than 1, then the
** value is unchanged and control passes through to the next instruction.
*/
case OP_IfPos: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];
assert( pIn1->flags&MEM_Int );
VdbeBranchTaken( pIn1->u.i>0, 2);
if( pIn1->u.i>0 ){
pc = pOp->p2 - 1;
|
| ︙ | ︙ | |||
75873 75874 75875 75876 75877 75878 75879 |
VdbeBranchTaken(pIn1->u.i<0, 2);
if( pIn1->u.i<0 ){
pc = pOp->p2 - 1;
}
break;
}
| | | | | > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 75945 75946 75947 75948 75949 75950 75951 75952 75953 75954 75955 75956 75957 75958 75959 75960 75961 75962 75963 75964 75965 75966 75967 75968 75969 75970 75971 75972 75973 75974 75975 75976 75977 75978 75979 75980 75981 75982 75983 75984 75985 75986 75987 75988 75989 75990 75991 75992 75993 75994 75995 75996 75997 75998 75999 76000 76001 76002 76003 76004 76005 76006 76007 76008 76009 76010 76011 |
VdbeBranchTaken(pIn1->u.i<0, 2);
if( pIn1->u.i<0 ){
pc = pOp->p2 - 1;
}
break;
}
/* Opcode: IfNotZero P1 P2 P3 * *
** Synopsis: if r[P1]!=0 then r[P1]+=P3, goto P2
**
** Register P1 must contain an integer. If the content of register P1 is
** initially nonzero, then add P3 to P1 and jump to P2. If register P1 is
** initially zero, leave it unchanged and fall through.
*/
case OP_IfNotZero: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];
assert( pIn1->flags&MEM_Int );
VdbeBranchTaken(pIn1->u.i<0, 2);
if( pIn1->u.i ){
pIn1->u.i += pOp->p3;
pc = pOp->p2 - 1;
}
break;
}
/* Opcode: DecrJumpZero P1 P2 * * *
** Synopsis: if (--r[P1])==0 goto P2
**
** Register P1 must hold an integer. Decrement the value in register P1
** then jump to P2 if the new value is exactly zero.
*/
case OP_DecrJumpZero: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];
assert( pIn1->flags&MEM_Int );
pIn1->u.i--;
VdbeBranchTaken(pIn1->u.i==0, 2);
if( pIn1->u.i==0 ){
pc = pOp->p2 - 1;
}
break;
}
/* Opcode: JumpZeroIncr P1 P2 * * *
** Synopsis: if (r[P1]++)==0 ) goto P2
**
** The register P1 must contain an integer. If register P1 is initially
** zero, then jump to P2. Increment register P1 regardless of whether or
** not the jump is taken.
*/
case OP_JumpZeroIncr: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];
assert( pIn1->flags&MEM_Int );
VdbeBranchTaken(pIn1->u.i==0, 2);
if( (pIn1->u.i++)==0 ){
pc = pOp->p2 - 1;
}
break;
}
/* Opcode: AggStep * P2 P3 P4 P5
** Synopsis: accum=r[P3] step(r[P2@P5])
**
** Execute the step function for an aggregate. The
** function has P5 arguments. P4 is a pointer to the FuncDef
** structure that specifies the function. Use register
** P3 as the accumulator.
|
| ︙ | ︙ | |||
97179 97180 97181 97182 97183 97184 97185 97186 97187 97188 97189 97190 97191 97192 |
/*
** pExpr points to an expression which implements a function. If
** it is appropriate to apply the LIKE optimization to that function
** then set aWc[0] through aWc[2] to the wildcard characters and
** return TRUE. If the function is not a LIKE-style function then
** return FALSE.
*/
SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
FuncDef *pDef;
if( pExpr->op!=TK_FUNCTION
|| !pExpr->x.pList
|| pExpr->x.pList->nExpr!=2
){
| > > > > > | 97287 97288 97289 97290 97291 97292 97293 97294 97295 97296 97297 97298 97299 97300 97301 97302 97303 97304 97305 |
/*
** pExpr points to an expression which implements a function. If
** it is appropriate to apply the LIKE optimization to that function
** then set aWc[0] through aWc[2] to the wildcard characters and
** return TRUE. If the function is not a LIKE-style function then
** return FALSE.
**
** *pIsNocase is set to true if uppercase and lowercase are equivalent for
** the function (default for LIKE). If the function makes the distinction
** between uppercase and lowercase (as does GLOB) then *pIsNocase is set to
** false.
*/
SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
FuncDef *pDef;
if( pExpr->op!=TK_FUNCTION
|| !pExpr->x.pList
|| pExpr->x.pList->nExpr!=2
){
|
| ︙ | ︙ | |||
102970 102971 102972 102973 102974 102975 102976 102977 102978 102979 102980 102981 102982 102983 |
if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
goto pragma_out;
}
/* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS
** connection. If it returns SQLITE_OK, then assume that the VFS
** handled the pragma and generate a no-op prepared statement.
*/
aFcntl[0] = 0;
aFcntl[1] = zLeft;
aFcntl[2] = zRight;
aFcntl[3] = 0;
db->busyHandler.nBusy = 0;
rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);
| > > > > > > > > > > > | 103083 103084 103085 103086 103087 103088 103089 103090 103091 103092 103093 103094 103095 103096 103097 103098 103099 103100 103101 103102 103103 103104 103105 103106 103107 |
if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
goto pragma_out;
}
/* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS
** connection. If it returns SQLITE_OK, then assume that the VFS
** handled the pragma and generate a no-op prepared statement.
**
** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed,
** an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file
** object corresponding to the database file to which the pragma
** statement refers.
**
** IMPLEMENTATION-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA
** file control is an array of pointers to strings (char**) in which the
** second element of the array is the name of the pragma and the third
** element is the argument to the pragma or NULL if the pragma has no
** argument.
*/
aFcntl[0] = 0;
aFcntl[1] = zLeft;
aFcntl[2] = zRight;
aFcntl[3] = 0;
db->busyHandler.nBusy = 0;
rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);
|
| ︙ | ︙ | |||
103730 103731 103732 103733 103734 103735 103736 |
case PragTyp_INDEX_INFO: if( zRight ){
Index *pIdx;
Table *pTab;
pIdx = sqlite3FindIndex(db, zRight, zDb);
if( pIdx ){
int i;
| > | > > > > > > > > | < > | | | > > | | | > | | 103854 103855 103856 103857 103858 103859 103860 103861 103862 103863 103864 103865 103866 103867 103868 103869 103870 103871 103872 103873 103874 103875 103876 103877 103878 103879 103880 103881 103882 103883 103884 103885 103886 103887 103888 103889 103890 103891 103892 103893 103894 103895 103896 103897 103898 103899 103900 103901 103902 103903 |
case PragTyp_INDEX_INFO: if( zRight ){
Index *pIdx;
Table *pTab;
pIdx = sqlite3FindIndex(db, zRight, zDb);
if( pIdx ){
int i;
int mx;
if( pPragma->iArg ){
/* PRAGMA index_xinfo (newer version with more rows and columns) */
mx = pIdx->nColumn;
pParse->nMem = 6;
}else{
/* PRAGMA index_info (legacy version) */
mx = pIdx->nKeyCol;
pParse->nMem = 3;
}
pTab = pIdx->pTable;
sqlite3VdbeSetNumCols(v, pParse->nMem);
sqlite3CodeVerifySchema(pParse, iDb);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seqno", SQLITE_STATIC);
sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "cid", SQLITE_STATIC);
sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "name", SQLITE_STATIC);
if( pPragma->iArg ){
sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "desc", SQLITE_STATIC);
sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "coll", SQLITE_STATIC);
sqlite3VdbeSetColName(v, 5, COLNAME_NAME, "key", SQLITE_STATIC);
}
for(i=0; i<mx; i++){
i16 cnum = pIdx->aiColumn[i];
sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
sqlite3VdbeAddOp2(v, OP_Integer, cnum, 2);
if( cnum<0 ){
sqlite3VdbeAddOp2(v, OP_Null, 0, 3);
}else{
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0);
}
if( pPragma->iArg ){
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->aSortOrder[i], 4);
sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, pIdx->azColl[i], 0);
sqlite3VdbeAddOp2(v, OP_Integer, i<pIdx->nKeyCol, 6);
}
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);
}
}
}
break;
case PragTyp_INDEX_LIST: if( zRight ){
Index *pIdx;
|
| ︙ | ︙ | |||
104455 104456 104457 104458 104459 104460 104461 | } break; #endif /* ** PRAGMA shrink_memory ** | | | > | 104591 104592 104593 104594 104595 104596 104597 104598 104599 104600 104601 104602 104603 104604 104605 104606 104607 |
}
break;
#endif
/*
** PRAGMA shrink_memory
**
** IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database
** connection on which it is invoked to free up as much memory as it
** can, by calling sqlite3_db_release_memory().
*/
case PragTyp_SHRINK_MEMORY: {
sqlite3_db_release_memory(db);
break;
}
/*
|
| ︙ | ︙ | |||
104485 104486 104487 104488 104489 104490 104491 |
break;
}
/*
** PRAGMA soft_heap_limit
** PRAGMA soft_heap_limit = N
**
| > | | > > > | 104622 104623 104624 104625 104626 104627 104628 104629 104630 104631 104632 104633 104634 104635 104636 104637 104638 104639 104640 104641 |
break;
}
/*
** PRAGMA soft_heap_limit
** PRAGMA soft_heap_limit = N
**
** IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the
** sqlite3_soft_heap_limit64() interface with the argument N, if N is
** specified and is a non-negative integer.
** IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always
** returns the same integer that would be returned by the
** sqlite3_soft_heap_limit64(-1) C-language function.
*/
case PragTyp_SOFT_HEAP_LIMIT: {
sqlite3_int64 N;
if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){
sqlite3_soft_heap_limit64(N);
}
returnSingleInt(pParse, "soft_heap_limit", sqlite3_soft_heap_limit64(-1));
|
| ︙ | ︙ | |||
106063 106064 106065 106066 106067 106068 106069 |
if( pSort->sortFlags & SORTFLAG_UseSorter ){
op = OP_SorterInsert;
}else{
op = OP_IdxInsert;
}
sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord);
if( pSelect->iLimit ){
| | < < | < | | 106204 106205 106206 106207 106208 106209 106210 106211 106212 106213 106214 106215 106216 106217 106218 106219 106220 106221 106222 106223 106224 106225 106226 106227 106228 |
if( pSort->sortFlags & SORTFLAG_UseSorter ){
op = OP_SorterInsert;
}else{
op = OP_IdxInsert;
}
sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord);
if( pSelect->iLimit ){
int addr;
int iLimit;
if( pSelect->iOffset ){
iLimit = pSelect->iOffset+1;
}else{
iLimit = pSelect->iLimit;
}
addr = sqlite3VdbeAddOp3(v, OP_IfNotZero, iLimit, 0, -1); VdbeCoverage(v);
sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor);
sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor);
sqlite3VdbeJumpHere(v, addr);
}
}
/*
** Add code to implement the OFFSET
*/
static void codeOffset(
|
| ︙ | ︙ | |||
106473 106474 106475 106476 106477 106478 106479 |
}
/* Jump to the end of the loop if the LIMIT is reached. Except, if
** there is a sorter, in which case the sorter has already limited
** the output for us.
*/
if( pSort==0 && p->iLimit ){
| | | 106611 106612 106613 106614 106615 106616 106617 106618 106619 106620 106621 106622 106623 106624 106625 |
}
/* Jump to the end of the loop if the LIMIT is reached. Except, if
** there is a sorter, in which case the sorter has already limited
** the output for us.
*/
if( pSort==0 && p->iLimit ){
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v);
}
}
/*
** Allocate a KeyInfo object sufficient for an index of N key columns and
** X extra columns.
*/
|
| ︙ | ︙ | |||
107326 107327 107328 107329 107330 107331 107332 |
}else if( n>=0 && p->nSelectRow>(u64)n ){
p->nSelectRow = n;
}
}else{
sqlite3ExprCode(pParse, p->pLimit, iLimit);
sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v);
VdbeComment((v, "LIMIT counter"));
| | | 107464 107465 107466 107467 107468 107469 107470 107471 107472 107473 107474 107475 107476 107477 107478 |
}else if( n>=0 && p->nSelectRow>(u64)n ){
p->nSelectRow = n;
}
}else{
sqlite3ExprCode(pParse, p->pLimit, iLimit);
sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v);
VdbeComment((v, "LIMIT counter"));
sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v);
}
if( p->pOffset ){
p->iOffset = iOffset = ++pParse->nMem;
pParse->nMem++; /* Allocate an extra register for limit+offset */
sqlite3ExprCode(pParse, p->pOffset, iOffset);
sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v);
VdbeComment((v, "OFFSET counter"));
|
| ︙ | ︙ | |||
107545 107546 107547 107548 107549 107550 107551 |
/* Output the single row in Current */
addrCont = sqlite3VdbeMakeLabel(v);
codeOffset(v, regOffset, addrCont);
selectInnerLoop(pParse, p, p->pEList, iCurrent,
0, 0, pDest, addrCont, addrBreak);
if( regLimit ){
| | | 107683 107684 107685 107686 107687 107688 107689 107690 107691 107692 107693 107694 107695 107696 107697 |
/* Output the single row in Current */
addrCont = sqlite3VdbeMakeLabel(v);
codeOffset(v, regOffset, addrCont);
selectInnerLoop(pParse, p, p->pEList, iCurrent,
0, 0, pDest, addrCont, addrBreak);
if( regLimit ){
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak);
VdbeCoverage(v);
}
sqlite3VdbeResolveLabel(v, addrCont);
/* Execute the recursive SELECT taking the single row in Current as
** the value for the recursive-table. Store the results in the Queue.
*/
|
| ︙ | ︙ | |||
107770 107771 107772 107773 107774 107775 107776 |
if( rc ){
goto multi_select_end;
}
p->pPrior = 0;
p->iLimit = pPrior->iLimit;
p->iOffset = pPrior->iOffset;
if( p->iLimit ){
| | | 107908 107909 107910 107911 107912 107913 107914 107915 107916 107917 107918 107919 107920 107921 107922 |
if( rc ){
goto multi_select_end;
}
p->pPrior = 0;
p->iLimit = pPrior->iLimit;
p->iOffset = pPrior->iOffset;
if( p->iLimit ){
addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);
VdbeComment((v, "Jump ahead if LIMIT reached"));
}
explainSetInteger(iSub2, pParse->iNextSelectId);
rc = sqlite3Select(pParse, p, &dest);
testcase( rc!=SQLITE_OK );
pDelete = p->pPrior;
p->pPrior = pPrior;
|
| ︙ | ︙ | |||
108171 108172 108173 108174 108175 108176 108177 |
break;
}
}
/* Jump to the end of the loop if the LIMIT is reached.
*/
if( p->iLimit ){
| | | 108309 108310 108311 108312 108313 108314 108315 108316 108317 108318 108319 108320 108321 108322 108323 |
break;
}
}
/* Jump to the end of the loop if the LIMIT is reached.
*/
if( p->iLimit ){
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v);
}
/* Generate the subroutine return
*/
sqlite3VdbeResolveLabel(v, iContinue);
sqlite3VdbeAddOp1(v, OP_Return, regReturn);
|
| ︙ | ︙ | |||
114785 114786 114787 114788 114789 114790 114791 114792 114793 114794 114795 114796 114797 114798 |
int iIdxCur; /* The VDBE cursor used to access pIdx */
int addrBrk; /* Jump here to break out of the loop */
int addrNxt; /* Jump here to start the next IN combination */
int addrSkip; /* Jump here for next iteration of skip-scan */
int addrCont; /* Jump here to continue with the next loop cycle */
int addrFirst; /* First instruction of interior of the loop */
int addrBody; /* Beginning of the body of this loop */
u8 iFrom; /* Which entry in the FROM clause */
u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
int p1, p2; /* Operands of the opcode used to ends the loop */
union { /* Information that depends on pWLoop->wsFlags */
struct {
int nIn; /* Number of entries in aInLoop[] */
struct InLoop {
| > > | 114923 114924 114925 114926 114927 114928 114929 114930 114931 114932 114933 114934 114935 114936 114937 114938 |
int iIdxCur; /* The VDBE cursor used to access pIdx */
int addrBrk; /* Jump here to break out of the loop */
int addrNxt; /* Jump here to start the next IN combination */
int addrSkip; /* Jump here for next iteration of skip-scan */
int addrCont; /* Jump here to continue with the next loop cycle */
int addrFirst; /* First instruction of interior of the loop */
int addrBody; /* Beginning of the body of this loop */
int iLikeRepCntr; /* LIKE range processing counter register */
int addrLikeRep; /* LIKE range processing address */
u8 iFrom; /* Which entry in the FROM clause */
u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
int p1, p2; /* Operands of the opcode used to ends the loop */
union { /* Information that depends on pWLoop->wsFlags */
struct {
int nIn; /* Number of entries in aInLoop[] */
struct InLoop {
|
| ︙ | ︙ | |||
114969 114970 114971 114972 114973 114974 114975 |
union {
int leftColumn; /* Column number of X in "X <op> <expr>" */
WhereOrInfo *pOrInfo; /* Extra information if (eOperator & WO_OR)!=0 */
WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */
} u;
LogEst truthProb; /* Probability of truth for this expression */
u16 eOperator; /* A WO_xx value describing <op> */
| | | 115109 115110 115111 115112 115113 115114 115115 115116 115117 115118 115119 115120 115121 115122 115123 |
union {
int leftColumn; /* Column number of X in "X <op> <expr>" */
WhereOrInfo *pOrInfo; /* Extra information if (eOperator & WO_OR)!=0 */
WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */
} u;
LogEst truthProb; /* Probability of truth for this expression */
u16 eOperator; /* A WO_xx value describing <op> */
u16 wtFlags; /* TERM_xxx bit flags. See below */
u8 nChild; /* Number of children that must disable us */
WhereClause *pWC; /* The clause this term is part of */
Bitmask prereqRight; /* Bitmask of tables used by pExpr->pRight */
Bitmask prereqAll; /* Bitmask of tables referenced by pExpr */
};
/*
|
| ︙ | ︙ | |||
114991 114992 114993 114994 114995 114996 114997 114998 114999 115000 115001 115002 115003 115004 |
#define TERM_ANDINFO 0x20 /* Need to free the WhereTerm.u.pAndInfo obj */
#define TERM_OR_OK 0x40 /* Used during OR-clause processing */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
# define TERM_VNULL 0x80 /* Manufactured x>NULL or x<=NULL term */
#else
# define TERM_VNULL 0x00 /* Disabled if not using stat3 */
#endif
/*
** An instance of the WhereScan object is used as an iterator for locating
** terms in the WHERE clause that are useful to the query planner.
*/
struct WhereScan {
WhereClause *pOrigWC; /* Original, innermost WhereClause */
| > > > | 115131 115132 115133 115134 115135 115136 115137 115138 115139 115140 115141 115142 115143 115144 115145 115146 115147 |
#define TERM_ANDINFO 0x20 /* Need to free the WhereTerm.u.pAndInfo obj */
#define TERM_OR_OK 0x40 /* Used during OR-clause processing */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
# define TERM_VNULL 0x80 /* Manufactured x>NULL or x<=NULL term */
#else
# define TERM_VNULL 0x00 /* Disabled if not using stat3 */
#endif
#define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
#define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
#define TERM_LIKE 0x400 /* The original LIKE operator */
/*
** An instance of the WhereScan object is used as an iterator for locating
** terms in the WHERE clause that are useful to the query planner.
*/
struct WhereScan {
WhereClause *pOrigWC; /* Original, innermost WhereClause */
|
| ︙ | ︙ | |||
115366 115367 115368 115369 115370 115371 115372 | ** This is true even if this routine fails to allocate a new WhereTerm. ** ** WARNING: This routine might reallocate the space used to store ** WhereTerms. All pointers to WhereTerms should be invalidated after ** calling this routine. Such pointers may be reinitialized by referencing ** the pWC->a[] array. */ | | | 115509 115510 115511 115512 115513 115514 115515 115516 115517 115518 115519 115520 115521 115522 115523 |
** This is true even if this routine fails to allocate a new WhereTerm.
**
** WARNING: This routine might reallocate the space used to store
** WhereTerms. All pointers to WhereTerms should be invalidated after
** calling this routine. Such pointers may be reinitialized by referencing
** the pWC->a[] array.
*/
static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
WhereTerm *pTerm;
int idx;
testcase( wtFlags & TERM_VIRTUAL );
if( pWC->nTerm>=pWC->nSlot ){
WhereTerm *pOld = pWC->a;
sqlite3 *db = pWC->pWInfo->pParse->db;
pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 );
|
| ︙ | ︙ | |||
115791 115792 115793 115794 115795 115796 115797 | #ifndef SQLITE_OMIT_LIKE_OPTIMIZATION /* ** Check to see if the given expression is a LIKE or GLOB operator that ** can be optimized using inequality constraints. Return TRUE if it is ** so and false if not. ** ** In order for the operator to be optimizible, the RHS must be a string | | > > > > | 115934 115935 115936 115937 115938 115939 115940 115941 115942 115943 115944 115945 115946 115947 115948 115949 115950 115951 115952 | #ifndef SQLITE_OMIT_LIKE_OPTIMIZATION /* ** Check to see if the given expression is a LIKE or GLOB operator that ** can be optimized using inequality constraints. Return TRUE if it is ** so and false if not. ** ** In order for the operator to be optimizible, the RHS must be a string ** literal that does not begin with a wildcard. The LHS must be a column ** that may only be NULL, a string, or a BLOB, never a number. (This means ** that virtual tables cannot participate in the LIKE optimization.) If the ** collating sequence for the column on the LHS must be appropriate for ** the operator. */ static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ |
| ︙ | ︙ | |||
115820 115821 115822 115823 115824 115825 115826 | #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT | | | 115967 115968 115969 115970 115971 115972 115973 115974 115975 115976 115977 115978 115979 115980 115981 |
#ifdef SQLITE_EBCDIC
if( *pnoCase ) return 0;
#endif
pList = pExpr->x.pList;
pLeft = pList->a[1].pExpr;
if( pLeft->op!=TK_COLUMN
|| sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|| IsVirtual(pLeft->pTab) /* Value might be numeric */
){
/* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must
** be the name of an indexed column with TEXT affinity. */
return 0;
}
assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */
|
| ︙ | ︙ | |||
116269 116270 116271 116272 116273 116274 116275 | WhereMaskSet *pMaskSet; /* Set of table index masks */ Expr *pExpr; /* The expression to be analyzed */ Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */ Bitmask prereqAll; /* Prerequesites of pExpr */ Bitmask extraRight = 0; /* Extra dependencies on LEFT JOIN */ Expr *pStr1 = 0; /* RHS of LIKE/GLOB operator */ int isComplete = 0; /* RHS of LIKE/GLOB ends with wildcard */ | | | 116416 116417 116418 116419 116420 116421 116422 116423 116424 116425 116426 116427 116428 116429 116430 |
WhereMaskSet *pMaskSet; /* Set of table index masks */
Expr *pExpr; /* The expression to be analyzed */
Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */
Bitmask prereqAll; /* Prerequesites of pExpr */
Bitmask extraRight = 0; /* Extra dependencies on LEFT JOIN */
Expr *pStr1 = 0; /* RHS of LIKE/GLOB operator */
int isComplete = 0; /* RHS of LIKE/GLOB ends with wildcard */
int noCase = 0; /* uppercase equivalent to lowercase */
int op; /* Top-level operator. pExpr->op */
Parse *pParse = pWInfo->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection */
if( db->mallocFailed ){
return;
}
|
| ︙ | ︙ | |||
116407 116408 116409 116410 116411 116412 116413 | } #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ #ifndef SQLITE_OMIT_LIKE_OPTIMIZATION /* Add constraints to reduce the search space on a LIKE or GLOB ** operator. ** | | | | > > > > > > > > > > > > > > > > > > > | | | | 116554 116555 116556 116557 116558 116559 116560 116561 116562 116563 116564 116565 116566 116567 116568 116569 116570 116571 116572 116573 116574 116575 116576 116577 116578 116579 116580 116581 116582 116583 116584 116585 116586 116587 116588 116589 116590 116591 116592 116593 116594 116595 116596 116597 116598 116599 116600 116601 116602 116603 116604 116605 116606 116607 116608 116609 116610 116611 116612 116613 116614 116615 116616 116617 116618 116619 116620 116621 116622 116623 116624 116625 116626 116627 116628 116629 116630 116631 116632 116633 116634 116635 116636 116637 116638 |
}
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
/* Add constraints to reduce the search space on a LIKE or GLOB
** operator.
**
** A like pattern of the form "x LIKE 'aBc%'" is changed into constraints
**
** x>='ABC' AND x<'abd' AND x LIKE 'aBc%'
**
** The last character of the prefix "abc" is incremented to form the
** termination condition "abd". If case is not significant (the default
** for LIKE) then the lower-bound is made all uppercase and the upper-
** bound is made all lowercase so that the bounds also work when comparing
** BLOBs.
*/
if( pWC->op==TK_AND
&& isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)
){
Expr *pLeft; /* LHS of LIKE/GLOB operator */
Expr *pStr2; /* Copy of pStr1 - RHS of LIKE/GLOB operator */
Expr *pNewExpr1;
Expr *pNewExpr2;
int idxNew1;
int idxNew2;
Token sCollSeqName; /* Name of collating sequence */
const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC;
pLeft = pExpr->x.pList->a[1].pExpr;
pStr2 = sqlite3ExprDup(db, pStr1, 0);
/* Convert the lower bound to upper-case and the upper bound to
** lower-case (upper-case is less than lower-case in ASCII) so that
** the range constraints also work for BLOBs
*/
if( noCase && !pParse->db->mallocFailed ){
int i;
char c;
pTerm->wtFlags |= TERM_LIKE;
for(i=0; (c = pStr1->u.zToken[i])!=0; i++){
pStr1->u.zToken[i] = sqlite3Toupper(c);
pStr2->u.zToken[i] = sqlite3Tolower(c);
}
}
if( !db->mallocFailed ){
u8 c, *pC; /* Last character before the first wildcard */
pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];
c = *pC;
if( noCase ){
/* The point is to increment the last character before the first
** wildcard. But if we increment '@', that will push it into the
** alphabetic range where case conversions will mess up the
** inequality. To avoid this, make sure to also run the full
** LIKE on all candidate expressions by clearing the isComplete flag
*/
if( c=='A'-1 ) isComplete = 0;
c = sqlite3UpperToLower[c];
}
*pC = c + 1;
}
sCollSeqName.z = noCase ? "NOCASE" : "BINARY";
sCollSeqName.n = 6;
pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
sqlite3ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName),
pStr1, 0);
transferJoinMarkings(pNewExpr1, pExpr);
idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags);
testcase( idxNew1==0 );
exprAnalyze(pSrc, pWC, idxNew1);
pNewExpr2 = sqlite3ExprDup(db, pLeft, 0);
pNewExpr2 = sqlite3PExpr(pParse, TK_LT,
sqlite3ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName),
pStr2, 0);
transferJoinMarkings(pNewExpr2, pExpr);
idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags);
testcase( idxNew2==0 );
exprAnalyze(pSrc, pWC, idxNew2);
pTerm = &pWC->a[idxTerm];
if( isComplete ){
markTermAsChild(pWC, idxNew1, idxTerm);
markTermAsChild(pWC, idxNew2, idxTerm);
}
|
| ︙ | ︙ | |||
117633 117634 117635 117636 117637 117638 117639 117640 117641 |
** Disabling a term causes that term to not be tested in the inner loop
** of the join. Disabling is an optimization. When terms are satisfied
** by indices, we disable them to prevent redundant tests in the inner
** loop. We would get the correct results if nothing were ever disabled,
** but joins might run a little slower. The trick is to disable as much
** as we can without disabling too much. If we disabled in (1), we'd get
** the wrong answer. See ticket #813.
*/
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
| > > > > > > > > > > > > > > > > > > > > | > > > | > | | | | < < > | 117799 117800 117801 117802 117803 117804 117805 117806 117807 117808 117809 117810 117811 117812 117813 117814 117815 117816 117817 117818 117819 117820 117821 117822 117823 117824 117825 117826 117827 117828 117829 117830 117831 117832 117833 117834 117835 117836 117837 117838 117839 117840 117841 117842 117843 117844 117845 117846 117847 117848 117849 |
** Disabling a term causes that term to not be tested in the inner loop
** of the join. Disabling is an optimization. When terms are satisfied
** by indices, we disable them to prevent redundant tests in the inner
** loop. We would get the correct results if nothing were ever disabled,
** but joins might run a little slower. The trick is to disable as much
** as we can without disabling too much. If we disabled in (1), we'd get
** the wrong answer. See ticket #813.
**
** If all the children of a term are disabled, then that term is also
** automatically disabled. In this way, terms get disabled if derived
** virtual terms are tested first. For example:
**
** x GLOB 'abc*' AND x>='abc' AND x<'acd'
** \___________/ \______/ \_____/
** parent child1 child2
**
** Only the parent term was in the original WHERE clause. The child1
** and child2 terms were added by the LIKE optimization. If both of
** the virtual child terms are valid, then testing of the parent can be
** skipped.
**
** Usually the parent term is marked as TERM_CODED. But if the parent
** term was originally TERM_LIKE, then the parent gets TERM_LIKECOND instead.
** The TERM_LIKECOND marking indicates that the term should be coded inside
** a conditional such that is only evaluated on the second pass of a
** LIKE-optimization loop, when scanning BLOBs instead of strings.
*/
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
int nLoop = 0;
while( pTerm
&& (pTerm->wtFlags & TERM_CODED)==0
&& (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
&& (pLevel->notReady & pTerm->prereqAll)==0
){
if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){
pTerm->wtFlags |= TERM_LIKECOND;
}else{
pTerm->wtFlags |= TERM_CODED;
}
if( pTerm->iParent<0 ) break;
pTerm = &pTerm->pWC->a[pTerm->iParent];
pTerm->nChild--;
if( pTerm->nChild!=0 ) break;
nLoop++;
}
}
/*
** Code an OP_Affinity opcode to apply the column affinity string zAff
** to the n registers starting at base.
**
|
| ︙ | ︙ | |||
118130 118131 118132 118133 118134 118135 118136 |
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
);
}
#else
# define addScanStatus(a, b, c, d) ((void)d)
#endif
| > > > > > > > > > > > > > > > > > > | > | 118319 118320 118321 118322 118323 118324 118325 118326 118327 118328 118329 118330 118331 118332 118333 118334 118335 118336 118337 118338 118339 118340 118341 118342 118343 118344 118345 118346 118347 118348 118349 118350 118351 118352 |
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
);
}
#else
# define addScanStatus(a, b, c, d) ((void)d)
#endif
/*
** Look at the last instruction coded. If that instruction is OP_String8
** and if pLoop->iLikeRepCntr is non-zero, then change the P3 to be
** pLoop->iLikeRepCntr and set P5.
**
** The LIKE optimization trys to evaluate "x LIKE 'abc%'" as a range
** expression: "x>='ABC' AND x<'abd'". But this requires that the range
** scan loop run twice, once for strings and a second time for BLOBs.
** The OP_String opcodes on the second pass convert the upper and lower
** bound string contants to blobs. This routine makes the necessary changes
** to the OP_String opcodes for that to happen.
*/
static void whereLikeOptimizationStringFixup(Vdbe *v, WhereLevel *pLevel){
VdbeOp *pOp;
pOp = sqlite3VdbeGetOp(v, -1);
if( pLevel->iLikeRepCntr && pOp->opcode==OP_String8 ){
pOp->p3 = pLevel->iLikeRepCntr;
pOp->p5 = 1;
}
}
/*
** Generate code for the start of the iLevel-th loop in the WHERE clause
** implementation described by pWInfo.
*/
static Bitmask codeOneLoopStart(
WhereInfo *pWInfo, /* Complete information about the WHERE clause */
|
| ︙ | ︙ | |||
118464 118465 118466 118467 118468 118469 118470 118471 118472 118473 118474 118475 118476 118477 |
if( pLoop->wsFlags & WHERE_BTM_LIMIT ){
pRangeStart = pLoop->aLTerm[j++];
nExtraReg = 1;
}
if( pLoop->wsFlags & WHERE_TOP_LIMIT ){
pRangeEnd = pLoop->aLTerm[j++];
nExtraReg = 1;
if( pRangeStart==0
&& (j = pIdx->aiColumn[nEq])>=0
&& pIdx->pTable->aCol[j].notNull==0
){
bSeekPastNull = 1;
}
}
| > > > > > > > > > > > > > | 118672 118673 118674 118675 118676 118677 118678 118679 118680 118681 118682 118683 118684 118685 118686 118687 118688 118689 118690 118691 118692 118693 118694 118695 118696 118697 118698 |
if( pLoop->wsFlags & WHERE_BTM_LIMIT ){
pRangeStart = pLoop->aLTerm[j++];
nExtraReg = 1;
}
if( pLoop->wsFlags & WHERE_TOP_LIMIT ){
pRangeEnd = pLoop->aLTerm[j++];
nExtraReg = 1;
if( pRangeStart
&& (pRangeStart->wtFlags & TERM_LIKEOPT)!=0
&& (pRangeEnd->wtFlags & TERM_LIKEOPT)!=0
){
pLevel->iLikeRepCntr = ++pParse->nMem;
testcase( bRev );
testcase( pIdx->aSortOrder[nEq]==SQLITE_SO_DESC );
sqlite3VdbeAddOp2(v, OP_Integer,
bRev ^ (pIdx->aSortOrder[nEq]==SQLITE_SO_DESC),
pLevel->iLikeRepCntr);
VdbeComment((v, "LIKE loop counter"));
pLevel->addrLikeRep = sqlite3VdbeCurrentAddr(v);
}
if( pRangeStart==0
&& (j = pIdx->aiColumn[nEq])>=0
&& pIdx->pTable->aCol[j].notNull==0
){
bSeekPastNull = 1;
}
}
|
| ︙ | ︙ | |||
118506 118507 118508 118509 118510 118511 118512 118513 118514 118515 118516 118517 118518 118519 |
start_constraints = pRangeStart || nEq>0;
/* Seek the index cursor to the start of the range. */
nConstraint = nEq;
if( pRangeStart ){
Expr *pRight = pRangeStart->pExpr->pRight;
sqlite3ExprCode(pParse, pRight, regBase+nEq);
if( (pRangeStart->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
VdbeCoverage(v);
}
if( zStartAff ){
| > | 118727 118728 118729 118730 118731 118732 118733 118734 118735 118736 118737 118738 118739 118740 118741 |
start_constraints = pRangeStart || nEq>0;
/* Seek the index cursor to the start of the range. */
nConstraint = nEq;
if( pRangeStart ){
Expr *pRight = pRangeStart->pExpr->pRight;
sqlite3ExprCode(pParse, pRight, regBase+nEq);
whereLikeOptimizationStringFixup(v, pLevel);
if( (pRangeStart->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
VdbeCoverage(v);
}
if( zStartAff ){
|
| ︙ | ︙ | |||
118551 118552 118553 118554 118555 118556 118557 118558 118559 118560 118561 118562 118563 118564 |
** range (if any).
*/
nConstraint = nEq;
if( pRangeEnd ){
Expr *pRight = pRangeEnd->pExpr->pRight;
sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
sqlite3ExprCode(pParse, pRight, regBase+nEq);
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
VdbeCoverage(v);
}
if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_NONE
| > | 118773 118774 118775 118776 118777 118778 118779 118780 118781 118782 118783 118784 118785 118786 118787 |
** range (if any).
*/
nConstraint = nEq;
if( pRangeEnd ){
Expr *pRight = pRangeEnd->pExpr->pRight;
sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
sqlite3ExprCode(pParse, pRight, regBase+nEq);
whereLikeOptimizationStringFixup(v, pLevel);
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
VdbeCoverage(v);
}
if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_NONE
|
| ︙ | ︙ | |||
118778 118779 118780 118781 118782 118783 118784 |
/* Run a separate WHERE clause for each term of the OR clause. After
** eliminating duplicates from other WHERE clauses, the action for each
** sub-WHERE clause is to to invoke the main loop body as a subroutine.
*/
wctrlFlags = WHERE_OMIT_OPEN_CLOSE
| WHERE_FORCE_TABLE
| | > | 119001 119002 119003 119004 119005 119006 119007 119008 119009 119010 119011 119012 119013 119014 119015 119016 |
/* Run a separate WHERE clause for each term of the OR clause. After
** eliminating duplicates from other WHERE clauses, the action for each
** sub-WHERE clause is to to invoke the main loop body as a subroutine.
*/
wctrlFlags = WHERE_OMIT_OPEN_CLOSE
| WHERE_FORCE_TABLE
| WHERE_ONETABLE_ONLY
| WHERE_NO_AUTOINDEX;
for(ii=0; ii<pOrWc->nTerm; ii++){
WhereTerm *pOrTerm = &pOrWc->a[ii];
if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
WhereInfo *pSubWInfo; /* Info for single OR-term scan */
Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
int j1 = 0; /* Address of jump operation */
if( pAndExpr && !ExprHasProperty(pOrExpr, EP_FromJoin) ){
|
| ︙ | ︙ | |||
118940 118941 118942 118943 118944 118945 118946 118947 118948 118949 118950 118951 118952 118953 118954 118955 118956 118957 118958 118959 118960 118961 118962 118963 118964 118965 118966 118967 118968 |
#endif
/* Insert code to test every subexpression that can be completely
** computed using the current set of tables.
*/
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
Expr *pE;
testcase( pTerm->wtFlags & TERM_VIRTUAL );
testcase( pTerm->wtFlags & TERM_CODED );
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
testcase( pWInfo->untestedTerms==0
&& (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 );
pWInfo->untestedTerms = 1;
continue;
}
pE = pTerm->pExpr;
assert( pE!=0 );
if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
continue;
}
sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
pTerm->wtFlags |= TERM_CODED;
}
/* Insert code to test for implied constraints based on transitivity
** of the "==" operator.
**
** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
| > > > > > > > | 119164 119165 119166 119167 119168 119169 119170 119171 119172 119173 119174 119175 119176 119177 119178 119179 119180 119181 119182 119183 119184 119185 119186 119187 119188 119189 119190 119191 119192 119193 119194 119195 119196 119197 119198 119199 |
#endif
/* Insert code to test every subexpression that can be completely
** computed using the current set of tables.
*/
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
Expr *pE;
int skipLikeAddr = 0;
testcase( pTerm->wtFlags & TERM_VIRTUAL );
testcase( pTerm->wtFlags & TERM_CODED );
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
testcase( pWInfo->untestedTerms==0
&& (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 );
pWInfo->untestedTerms = 1;
continue;
}
pE = pTerm->pExpr;
assert( pE!=0 );
if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
continue;
}
if( pTerm->wtFlags & TERM_LIKECOND ){
assert( pLevel->iLikeRepCntr>0 );
skipLikeAddr = sqlite3VdbeAddOp1(v, OP_IfNot, pLevel->iLikeRepCntr);
VdbeCoverage(v);
}
sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
pTerm->wtFlags |= TERM_CODED;
}
/* Insert code to test for implied constraints based on transitivity
** of the "==" operator.
**
** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
|
| ︙ | ︙ | |||
119972 119973 119974 119975 119976 119977 119978 119979 119980 119981 119982 119983 119984 119985 | } rSize = pTab->nRowLogEst; rLogSize = estLog(rSize); #ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ if( !pBuilder->pOrSet && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 && pSrc->pIndex==0 && !pSrc->viaCoroutine && !pSrc->notIndexed && HasRowid(pTab) && !pSrc->isCorrelated && !pSrc->isRecursive | > | 120203 120204 120205 120206 120207 120208 120209 120210 120211 120212 120213 120214 120215 120216 120217 | } rSize = pTab->nRowLogEst; rLogSize = estLog(rSize); #ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ if( !pBuilder->pOrSet && (pWInfo->wctrlFlags & WHERE_NO_AUTOINDEX)==0 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 && pSrc->pIndex==0 && !pSrc->viaCoroutine && !pSrc->notIndexed && HasRowid(pTab) && !pSrc->isCorrelated && !pSrc->isRecursive |
| ︙ | ︙ | |||
121756 121757 121758 121759 121760 121761 121762 121763 121764 121765 121766 121767 121768 121769 |
}
sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
if( pLevel->addrSkip ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrSkip);
VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
sqlite3VdbeJumpHere(v, pLevel->addrSkip);
sqlite3VdbeJumpHere(v, pLevel->addrSkip-2);
}
if( pLevel->iLeftJoin ){
addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
|| (pLoop->wsFlags & WHERE_INDEXED)!=0 );
if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 ){
sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor);
| > > > > > > > > > > | 121988 121989 121990 121991 121992 121993 121994 121995 121996 121997 121998 121999 122000 122001 122002 122003 122004 122005 122006 122007 122008 122009 122010 122011 |
}
sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
if( pLevel->addrSkip ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrSkip);
VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
sqlite3VdbeJumpHere(v, pLevel->addrSkip);
sqlite3VdbeJumpHere(v, pLevel->addrSkip-2);
}
if( pLevel->addrLikeRep ){
int op;
if( sqlite3VdbeGetOp(v, pLevel->addrLikeRep-1)->p1 ){
op = OP_DecrJumpZero;
}else{
op = OP_JumpZeroIncr;
}
sqlite3VdbeAddOp2(v, op, pLevel->iLikeRepCntr, pLevel->addrLikeRep);
VdbeCoverage(v);
}
if( pLevel->iLeftJoin ){
addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
|| (pLoop->wsFlags & WHERE_INDEXED)!=0 );
if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 ){
sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor);
|
| ︙ | ︙ | |||
126980 126981 126982 126983 126984 126985 126986 |
switch( op ){
/* Mutex configuration options are only available in a threadsafe
** compile.
*/
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-54466-46756 */
case SQLITE_CONFIG_SINGLETHREAD: {
| > | | | | | | | > | | | | 127222 127223 127224 127225 127226 127227 127228 127229 127230 127231 127232 127233 127234 127235 127236 127237 127238 127239 127240 127241 127242 127243 127244 127245 127246 127247 127248 127249 127250 127251 127252 127253 127254 127255 127256 127257 |
switch( op ){
/* Mutex configuration options are only available in a threadsafe
** compile.
*/
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-54466-46756 */
case SQLITE_CONFIG_SINGLETHREAD: {
/* EVIDENCE-OF: R-02748-19096 This option sets the threading mode to
** Single-thread. */
sqlite3GlobalConfig.bCoreMutex = 0; /* Disable mutex on core */
sqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */
break;
}
#endif
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-20520-54086 */
case SQLITE_CONFIG_MULTITHREAD: {
/* EVIDENCE-OF: R-14374-42468 This option sets the threading mode to
** Multi-thread. */
sqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */
sqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */
break;
}
#endif
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-59593-21810 */
case SQLITE_CONFIG_SERIALIZED: {
/* EVIDENCE-OF: R-41220-51800 This option sets the threading mode to
** Serialized. */
sqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */
sqlite3GlobalConfig.bFullMutex = 1; /* Enable mutex on connections */
break;
}
#endif
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-63666-48755 */
case SQLITE_CONFIG_MUTEX: {
/* Specify an alternative mutex implementation */
sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
|
| ︙ | ︙ | |||
127111 127112 127113 127114 127115 127116 127117 |
/* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only
** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or
** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
case SQLITE_CONFIG_HEAP: {
/* EVIDENCE-OF: R-19854-42126 There are three arguments to
** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the
| | > | 127355 127356 127357 127358 127359 127360 127361 127362 127363 127364 127365 127366 127367 127368 127369 127370 |
/* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only
** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or
** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
case SQLITE_CONFIG_HEAP: {
/* EVIDENCE-OF: R-19854-42126 There are three arguments to
** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the
** number of bytes in the memory buffer, and the minimum allocation size.
*/
sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
sqlite3GlobalConfig.nHeap = va_arg(ap, int);
sqlite3GlobalConfig.mnReq = va_arg(ap, int);
if( sqlite3GlobalConfig.mnReq<1 ){
sqlite3GlobalConfig.mnReq = 1;
}else if( sqlite3GlobalConfig.mnReq>(1<<12) ){
|
| ︙ | ︙ | |||
127216 127217 127218 127219 127220 127221 127222 |
** negative, then that argument is changed to its compile-time default.
**
** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be
** silently truncated if necessary so that it does not exceed the
** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE
** compile-time option.
*/
| | > > | 127461 127462 127463 127464 127465 127466 127467 127468 127469 127470 127471 127472 127473 127474 127475 127476 127477 |
** negative, then that argument is changed to its compile-time default.
**
** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be
** silently truncated if necessary so that it does not exceed the
** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE
** compile-time option.
*/
if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
mxMmap = SQLITE_MAX_MMAP_SIZE;
}
if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
if( szMmap>mxMmap) szMmap = mxMmap;
sqlite3GlobalConfig.mxMmap = mxMmap;
sqlite3GlobalConfig.szMmap = szMmap;
break;
}
|
| ︙ | ︙ | |||
129060 129061 129062 129063 129064 129065 129066 |
flags |= SQLITE_OPEN_URI;
for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');
zFile = sqlite3_malloc(nByte);
if( !zFile ) return SQLITE_NOMEM;
iIn = 5;
| | > > > > > > > > > > > > | 129307 129308 129309 129310 129311 129312 129313 129314 129315 129316 129317 129318 129319 129320 129321 129322 129323 129324 129325 129326 129327 129328 129329 129330 129331 129332 129333 |
flags |= SQLITE_OPEN_URI;
for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');
zFile = sqlite3_malloc(nByte);
if( !zFile ) return SQLITE_NOMEM;
iIn = 5;
#ifdef SQLITE_ALLOW_URI_AUTHORITY
if( strncmp(zUri+5, "///", 3)==0 ){
iIn = 7;
/* The following condition causes URIs with five leading / characters
** like file://///host/path to be converted into UNCs like //host/path.
** The correct URI for that UNC has only two or four leading / characters
** file://host/path or file:////host/path. But 5 leading slashes is a
** common error, we are told, so we handle it as a special case. */
if( strncmp(zUri+7, "///", 3)==0 ){ iIn++; }
}else if( strncmp(zUri+5, "//localhost/", 12)==0 ){
iIn = 16;
}
#else
/* Discard the scheme and authority segments of the URI. */
if( zUri[5]=='/' && zUri[6]=='/' ){
iIn = 7;
while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
*pzErrMsg = sqlite3_mprintf("invalid uri authority: %.*s",
iIn-7, &zUri[7]);
|
| ︙ | ︙ | |||
129503 129504 129505 129506 129507 129508 129509 |
sqlite3GlobalConfig.nLookaside);
sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);
opendb_out:
sqlite3_free(zOpen);
if( db ){
| | > | 129762 129763 129764 129765 129766 129767 129768 129769 129770 129771 129772 129773 129774 129775 129776 129777 |
sqlite3GlobalConfig.nLookaside);
sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);
opendb_out:
sqlite3_free(zOpen);
if( db ){
assert( db->mutex!=0 || isThreadsafe==0
|| sqlite3GlobalConfig.bFullMutex==0 );
sqlite3_mutex_leave(db->mutex);
}
rc = sqlite3_errcode(db);
assert( db!=0 || rc==SQLITE_NOMEM );
if( rc==SQLITE_NOMEM ){
sqlite3_close(db);
db = 0;
|
| ︙ | ︙ | |||
130248 130249 130250 130251 130252 130253 130254 |
** not.
*/
case SQLITE_TESTCTRL_ISINIT: {
if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR;
break;
}
| | | | | 130508 130509 130510 130511 130512 130513 130514 130515 130516 130517 130518 130519 130520 130521 130522 130523 130524 130525 130526 130527 130528 130529 130530 130531 130532 |
** not.
*/
case SQLITE_TESTCTRL_ISINIT: {
if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR;
break;
}
/* sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum);
**
** This test control is used to create imposter tables. "db" is a pointer
** to the database connection. dbName is the database name (ex: "main" or
** "temp") which will receive the imposter. "onOff" turns imposter mode on
** or off. "tnum" is the root page of the b-tree to which the imposter
** table should connect.
**
** Enable imposter mode only when the schema has already been parsed. Then
** run a single CREATE TABLE statement to construct the imposter table in
** the parsed schema. Then turn imposter mode back off again.
**
** If onOff==0 and tnum>0 then reset the schema for all databases, causing
** the schema to be reparsed the next time it is needed. This has the
** effect of erasing all imposter tables.
*/
case SQLITE_TESTCTRL_IMPOSTER: {
sqlite3 *db = va_arg(ap, sqlite3*);
|
| ︙ | ︙ |
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.9" #define SQLITE_VERSION_NUMBER 3008009 #define SQLITE_SOURCE_ID "2015-03-09 10:40:48 e5da5e7d5dc5a3438ced23f1ee83e695abc29c45" /* ** 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 |
| ︙ | ︙ | |||
752 753 754 755 756 757 758 759 760 761 762 763 |
** CAPI3REF: Standard File Control Opcodes
** KEYWORDS: {file control opcodes} {file control opcode}
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
| > > | | | | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
** CAPI3REF: Standard File Control Opcodes
** KEYWORDS: {file control opcodes} {file control opcode}
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** <ul>
** <li>[[SQLITE_FCNTL_LOCKSTATE]]
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
** is used during testing and is only available when the SQLITE_TEST
** compile-time option is used.
**
** <li>[[SQLITE_FCNTL_SIZE_HINT]]
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
** layer a hint of how large the database file will grow to be during the
** current transaction. This hint is not guaranteed to be accurate but it
** is often close. The underlying VFS might choose to preallocate database
** file space based on this hint in order to help writes to the database
** file run faster.
|
| ︙ | ︙ | |||
884 885 886 887 888 889 890 | ** of the char** argument point to a string obtained from [sqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] ** file control returns [SQLITE_OK], then the parser assumes that the ** VFS has handled the PRAGMA itself and the parser generates a no-op | > > | | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | ** of the char** argument point to a string obtained from [sqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] ** file control returns [SQLITE_OK], then the parser assumes that the ** VFS has handled the PRAGMA itself and the parser generates a no-op ** prepared statement if result string is NULL, or that returns a copy ** of the result string if the string is non-NULL. ** ^If the [SQLITE_FCNTL_PRAGMA] file control returns ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means ** that the VFS encountered an error while handling the [PRAGMA] and the ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] ** file control occurs at the beginning of pragma statement analysis and so ** it is able to override built-in [PRAGMA] statements. ** ** <li>[[SQLITE_FCNTL_BUSYHANDLER]] |
| ︙ | ︙ | |||
1743 1744 1745 1746 1747 1748 1749 | ** ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value ** that specifies the maximum size of the created heap. | < | 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | ** ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value ** that specifies the maximum size of the created heap. ** ** [[SQLITE_CONFIG_PCACHE_HDRSZ]] ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which ** is a pointer to an integer and writes into that integer the number of extra ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE]. ** The amount of extra space required can change depending on the compiler, |
| ︙ | ︙ | |||
3183 3184 3185 3186 3187 3188 3189 | ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** | | | | | < | | | | < | 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 | ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** ** ^If the nByte argument is negative, then zSql is read up to the ** first zero terminator. ^If nByte is positive, then it is the ** number of bytes read from zSql. ^If nByte is zero, then no prepared ** statement is generated. ** If the caller knows that the supplied string is nul-terminated, then ** there is a small performance advantage to passing an nByte parameter that ** is the number of bytes in the input string <i>including</i> ** the nul-terminator. ** ** ^If pzTail is not NULL then *pzTail is made to point to the first byte ** past the end of the first SQL statement in zSql. These routines only ** compile the first statement in zSql, so *pzTail is left pointing to ** what remains uncompiled. ** ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be |
| ︙ | ︙ | |||
4221 4222 4223 4224 4225 4226 4227 | /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid | | | | 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 | /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To encourage programmers to avoid ** these functions, we will not explain what they do. */ #ifndef SQLITE_OMIT_DEPRECATED SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); |
| ︙ | ︙ | |||
6984 6985 6986 6987 6988 6989 6990 | ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** | | > | | | | < < | | < | > > | | 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 | ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** ** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]] ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b> ** ** ^The sqlite3_backup_remaining() routine returns the number of pages still ** to be backed up at the conclusion of the most recent sqlite3_backup_step(). ** ^The sqlite3_backup_pagecount() routine returns the total number of pages ** in the source database at the conclusion of the most recent ** sqlite3_backup_step(). ** ^(The values returned by these functions are only updated by ** sqlite3_backup_step(). If the source database is modified in a way that ** changes the size of the source database or the number of pages remaining, ** those changes are not reflected in the output of sqlite3_backup_pagecount() ** and sqlite3_backup_remaining() until after the next ** sqlite3_backup_step().)^ ** ** <b>Concurrent Usage of Database Handles</b> ** ** ^The source [database connection] may be used by the application for other ** purposes while a backup operation is underway or being initialized. ** ^If SQLite is compiled and configured to support threadsafe database ** connections, then the source database connection may be used concurrently |
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 |
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
** Make sure that the TH1 script error was not caused by a "missing"
** command hook handler as that is not actually an error condition.
*/
if( memcmp(zResult, NO_COMMAND_HOOK_ERROR, nResult)!=0 ){
sendError(zResult, nResult, 0);
}
}
/*
** If the script returned TH_ERROR (e.g. the "command_hook" TH1 command does
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip executing essential commands unless the called command
** (i.e. "command_hook") explicitly forbids this by successfully returning
** TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
/*
** Does our call to Th_FossilInit() result in opening a database? If so,
** clean it up now. This is very important because some commands do not
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
| > > > > > > | | 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 |
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
** Make sure that the TH1 script error was not caused by a "missing"
** command hook handler as that is not actually an error condition.
*/
if( memcmp(zResult, NO_COMMAND_HOOK_ERROR, nResult)!=0 ){
sendError(zResult, nResult, 0);
}else{
/*
** There is no command hook handler "installed". This situation
** is NOT actually an error.
*/
rc = TH_OK;
}
}
/*
** If the script returned TH_ERROR (e.g. the "command_hook" TH1 command does
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip executing essential commands unless the called command
** (i.e. "command_hook") explicitly forbids this by successfully returning
** TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
/*
** Does our call to Th_FossilInit() result in opening a database? If so,
** clean it up now. This is very important because some commands do not
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
return rc;
}
/*
** This function is called by Fossil just after dispatching a command.
** Returning a value other than TH_OK from this function (i.e. via an
** evaluated script raising an error or calling [break]/[continue]) may
** cause an error message to be displayed to the local interactive user.
|
| ︙ | ︙ | |||
1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 |
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
** Make sure that the TH1 script error was not caused by a "missing"
** webpage hook handler as that is not actually an error condition.
*/
if( memcmp(zResult, NO_WEBPAGE_HOOK_ERROR, nResult)!=0 ){
sendError(zResult, nResult, 1);
}
}
/*
** If the script returned TH_ERROR (e.g. the "webpage_hook" TH1 command does
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip processing essential web pages unless the called
** command (i.e. "webpage_hook") explicitly forbids this by successfully
** returning TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
/*
** Does our call to Th_FossilInit() result in opening a database? If so,
** clean it up now. This is very important because some commands do not
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
| > > > > > > | | 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 |
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
** Make sure that the TH1 script error was not caused by a "missing"
** webpage hook handler as that is not actually an error condition.
*/
if( memcmp(zResult, NO_WEBPAGE_HOOK_ERROR, nResult)!=0 ){
sendError(zResult, nResult, 1);
}else{
/*
** There is no webpage hook handler "installed". This situation
** is NOT actually an error.
*/
rc = TH_OK;
}
}
/*
** If the script returned TH_ERROR (e.g. the "webpage_hook" TH1 command does
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip processing essential web pages unless the called
** command (i.e. "webpage_hook") explicitly forbids this by successfully
** returning TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
/*
** Does our call to Th_FossilInit() result in opening a database? If so,
** clean it up now. This is very important because some commands do not
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
return rc;
}
/*
** This function is called by Fossil just after processing a web page.
** Returning a value other than TH_OK from this function (i.e. via an
** evaluated script raising an error or calling [break]/[continue]) may
** cause an error message to be displayed to the remote user.
|
| ︙ | ︙ | |||
1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 |
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
return rc;
}
#endif
/*
** The z[] input contains text mixed with TH1 scripts.
** The TH1 scripts are contained within <th1>...</th1>.
** TH1 variables are $aaa or $<aaa>. The first form of
** variable is literal. The second is run through htmlize
** before being inserted.
| > > > > > > > > > > > > > > | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 |
** expect the repository and/or the configuration ("user") database to be
** open prior to their own code doing so.
*/
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
return rc;
}
#endif
#ifdef FOSSIL_ENABLE_TH1_DOCS
/*
** This function determines if TH1 docs are enabled for the repository.
*/
int Th_AreDocsEnabled(void){
if( fossil_getenv("TH1_ENABLE_DOCS")!=0 ){
return 1;
}
return db_get_boolean("th1-docs", 0);
}
#endif
/*
** The z[] input contains text mixed with TH1 scripts.
** The TH1 scripts are contained within <th1>...</th1>.
** TH1 variables are $aaa or $<aaa>. The first form of
** variable is literal. The second is run through htmlize
** before being inserted.
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
750 751 752 753 754 755 756 |
@ do{
@ left += obj.offsetLeft;
@ }while( obj = obj.offsetParent );
@ }
@ return left;
@ }
@ function drawUpArrow(x,y0,y1){
| | > | < > < | < | | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
@ do{
@ left += obj.offsetLeft;
@ }while( obj = obj.offsetParent );
@ }
@ return left;
@ }
@ function drawUpArrow(x,y0,y1){
@ drawBox(lineClr,x,y0+4,x+1,y1);
@ var n = document.createElement("div"),
@ l = x-2,
@ t = y0;
@ n.style.position = "absolute";
@ n.style.left = l+"px";
@ n.style.top = t+"px";
@ n.style.width = 0;
@ n.style.height = 0;
@ n.style.transform = "scale(.999)";
@ n.style.borderWidth = 0;
@ n.style.borderStyle = "solid";
@ n.style.borderColor = "transparent";
@ n.style.borderRightWidth = "3px";
@ n.style.borderBottomColor = lineClr;
@ n.style.borderLeftWidth = "3px";
@ if( y0+10>=y1 ){
@ n.style.borderBottomWidth = "5px";
@ } else {
@ n.style.borderBottomWidth = "7px";
@ }
@ cDiv.appendChild(n);
@ }
@ function drawThinArrow(y,xFrom,xTo){
@ var n = document.createElement("div"),
@ t = y-2;
@ n.style.position = "absolute";
@ n.style.top = t+"px";
@ n.style.width = 0;
@ n.style.height = "1px";
@ n.style.transform = "scale(.999)";
@ n.style.borderWidth = 0;
@ n.style.borderStyle = "solid";
@ n.style.borderColor = "transparent";
@ n.style.borderTopWidth = "2px";
@ n.style.borderBottomWidth = "2px";
@ if( xFrom<xTo ){
@ drawBox(lineClr,xFrom,y,xTo-3,y);
@ n.style.left = xTo-3+"px";
@ n.style.borderLeftWidth = "3px";
@ n.style.borderLeftColor = lineClr;
@ }else{
@ drawBox(lineClr,xTo+3,y,xFrom,y);
@ n.style.left = xTo+1+"px";
@ n.style.borderRightWidth = "3px";
@ n.style.borderRightColor = lineClr;
@ }
@ cDiv.appendChild(n);
@ }
@ function drawThinLine(x0,y0,x1,y1){
@ drawBox(lineClr,x0,y0,x1,y1);
@ }
@ function drawNodeBox(color,x0,y0,x1,y1){
|
| ︙ | ︙ | |||
849 850 851 852 853 854 855 856 857 858 859 860 |
@ t = u.y-2,
@ l = u.x-11;
@ n.style.position = "absolute";
@ n.style.top = t+"px";
@ n.style.left = l+"px";
@ n.style.width = 0;
@ n.style.height = 0;
@ n.style.borderWidth = 0;
@ n.style.borderStyle = "solid";
@ n.style.borderColor = "transparent";
@ n.style.borderTopWidth = "3px";
@ n.style.borderBottomWidth = "3px";
| > < | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
@ t = u.y-2,
@ l = u.x-11;
@ n.style.position = "absolute";
@ n.style.top = t+"px";
@ n.style.left = l+"px";
@ n.style.width = 0;
@ n.style.height = 0;
@ n.style.transform = "scale(.999)";
@ n.style.borderWidth = 0;
@ n.style.borderStyle = "solid";
@ n.style.borderColor = "transparent";
@ n.style.borderTopWidth = "3px";
@ n.style.borderBottomWidth = "3px";
@ n.style.borderLeftWidth = "7px";
@ n.style.borderLeftColor = "#600000";
@ cDiv.appendChild(n);
@ }
@ }
@ for(var j in p.mi){
@ var y0 = p.y+5;
|
| ︙ | ︙ | |||
1419 1420 1421 1422 1423 1424 1425 |
style_submenu_binary("v","With Files","Without Files",
zType[0]!='a' && zType[0]!='c');
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
timeline_submenu(&url, "Unhide", "unhide", "", 0);
}
}else{
/* Otherwise, a timeline based on a span of time */
| | | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 |
style_submenu_binary("v","With Files","Without Files",
zType[0]!='a' && zType[0]!='c');
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
timeline_submenu(&url, "Unhide", "unhide", "", 0);
}
}else{
/* Otherwise, a timeline based on a span of time */
int n, nBefore, nAfter;
const char *zEType = "timeline item";
char *zDate;
if( zUses ){
blob_append_sql(&sql, " AND event.objid IN usesfile ");
}
if( renameOnly ){
blob_append_sql(&sql, " AND event.objid IN rnfile ");
|
| ︙ | ︙ | |||
1627 1628 1629 1630 1631 1632 1633 |
}else if( rCirca>0.0 ){
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
| > > > > > > > > > > > > > > > > > | | | | | | | | | | > | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 |
}else if( rCirca>0.0 ){
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
if( zCirca && rCirca ){
nBefore = db_int(0,
"SELECT count(*) FROM timeline WHERE etype!='div'"
" AND sortby<=%f /*scan*/", rCirca);
nAfter = db_int(0,
"SELECT count(*) FROM timeline WHERE etype!='div'"
" AND sortby>=%f /*scan*/", rCirca);
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
if( nBefore>=nEntry ){
timeline_submenu(&url, "Older", "b", zDate, "c");
zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "c", 0));
}
if( nAfter>=nEntry ){
timeline_submenu(&url, "Newer", "a", zDate, "c");
}
free(zDate);
}else{
if( zAfter || n==nEntry ){
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Older", "b", zDate, "a");
zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
free(zDate);
}
if( zBefore || (zAfter && n==nEntry) ){
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Newer", "a", zDate, "b");
free(zDate);
}
}
if( zType[0]=='a' || zType[0]=='c' ){
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
timeline_submenu(&url, "Unhide", "unhide", "", 0);
}
}
style_submenu_entry("n","Max:",4,0);
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
}else{
blob_appendf(p->pOut, "<span class=\"brokenlink\">[");
zTerm = "]</span>";
}
}else if( g.perm.Hyperlink ){
blob_appendf(p->pOut, "%z[",href("%R/info/%s", zTarget));
zTerm = "]</a>";
}
}else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
&& db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
blob_appendf(p->pOut, "<a href=\"%R/timeline?c=%T\">", zTarget);
}else if( (z = validWikiPageName(p, zTarget))!=0 ){
blob_appendf(p->pOut, "<a href=\"%R/wiki?name=%T\">", z);
}else if( zTarget>=&zOrig[2] && !fossil_isspace(zTarget[-2]) ){
| > > | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 |
}else{
blob_appendf(p->pOut, "<span class=\"brokenlink\">[");
zTerm = "]</span>";
}
}else if( g.perm.Hyperlink ){
blob_appendf(p->pOut, "%z[",href("%R/info/%s", zTarget));
zTerm = "]</a>";
}else{
zTerm = "";
}
}else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
&& db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
blob_appendf(p->pOut, "<a href=\"%R/timeline?c=%T\">", zTarget);
}else if( (z = validWikiPageName(p, zTarget))!=0 ){
blob_appendf(p->pOut, "<a href=\"%R/wiki?name=%T\">", z);
}else if( zTarget>=&zOrig[2] && !fossil_isspace(zTarget[-2]) ){
|
| ︙ | ︙ |
Changes to src/xfersetup.c.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 |
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Transfer Setup");
| | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Transfer Setup");
@ <table class="xfersetup">
setup_menu_entry("Common", "xfersetup_com",
"Common TH1 code run before all transfer request processing.");
setup_menu_entry("Push", "xfersetup_push",
"Specific TH1 code to run after \"push\" transfer requests.");
setup_menu_entry("Commit", "xfersetup_commit",
"Specific TH1 code to run after processing a commit.");
setup_menu_entry("Ticket", "xfersetup_ticket",
|
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
zWarning = 0;
}else{
syncFlags = SYNC_PUSH | SYNC_PULL;
zButton = "Synchronize";
zWarning = mprintf("WARNING: Pushing to \"%s\" is enabled.",
g.url.canonical);
}
| < < < < < | | | | | < < > > > > > > > | 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 |
zWarning = 0;
}else{
syncFlags = SYNC_PUSH | SYNC_PULL;
zButton = "Synchronize";
zWarning = mprintf("WARNING: Pushing to \"%s\" is enabled.",
g.url.canonical);
}
@ <p>Press the <strong>%h(zButton)</strong> button below to
@ synchronize with the <em>%h(g.url.canonical)</em> repository now.<br/>
@ This may be useful when testing the various transfer scripts.</p>
@ <p>You can use the <code>http -async</code> command in your scripts, but
@ make sure the <code>th1-uri-regexp</code> setting is set first.</p>
if( zWarning ){
@
@ <big><b>%h(zWarning)</b></big>
free(zWarning);
}
@
@ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
login_insert_csrf_secret();
@ <input type="submit" name="sync" value="%h(zButton)" />
@ </div></form>
@
if( P("sync") ){
user_select();
url_enable_proxy(0);
@ <pre class="xfersetup">
client_sync(syncFlags, 0, 0);
@ </pre>
}
}
style_footer();
}
/*
** Common implementation for the transfer setup editor pages.
|
| ︙ | ︙ | |||
135 136 137 138 139 140 141 |
cgi_redirect("xfersetup");
}
}
@ <form action="%s(g.zTop)/%s(g.zPath)" method="post"><div>
login_insert_csrf_secret();
@ <p>%s(zDesc)</p>
@ <textarea name="x" rows="%d(height)" cols="80">%h(z)</textarea>
| | | < > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
cgi_redirect("xfersetup");
}
}
@ <form action="%s(g.zTop)/%s(g.zPath)" method="post"><div>
login_insert_csrf_secret();
@ <p>%s(zDesc)</p>
@ <textarea name="x" rows="%d(height)" cols="80">%h(z)</textarea>
@ <p>
@ <input type="submit" name="submit" value="Apply Changes" />
@ <input type="submit" name="clear" value="Revert To Default" />
@ <input type="submit" name="setup" value="Cancel" />
@ </p>
@ </div></form>
if ( zDfltValue ){
@ <hr />
@ <h2>Default %s(zTitle)</h2>
@ <blockquote><pre>
@ %h(zDfltValue)
@ </pre></blockquote>
}
style_footer();
}
|
| ︙ | ︙ | |||
179 180 181 182 183 184 185 |
static const char *zDefaultXferPush = 0;
/*
** WEBPAGE: xfersetup_push
*/
void xfersetup_push_page(void){
static const char zDesc[] =
| | > | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
static const char *zDefaultXferPush = 0;
/*
** WEBPAGE: xfersetup_push
*/
void xfersetup_push_page(void){
static const char zDesc[] =
@ Enter TH1 script that runs after processing <strong>push</strong>
@ transfer requests.
;
xfersetup_generic(
"Transfer Push Script",
"xfer-push-script",
zDefaultXferPush,
zDesc,
0,
|
| ︙ | ︙ |
Added test/fileStat.th1.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 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 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 |
<th1>
proc doSomeTclSetup {} {
#
# NOTE: Copy repository file name to the Tcl interpreter. This is
# done first (once) because it will be necessary for almost
# everything else later on.
#
tclInvoke set repository [repository]
#
# NOTE: Create some procedures in the Tcl interpreter to perform
# useful operations. This could also do things like load
# packages, etc.
#
tclEval {
#
# NOTE: Returns an [exec] command for Fossil, using the provided
# sub-command and arguments, suitable for use with [eval]
# or [catch].
#
proc getFossilCommand { repository user args } {
global env
lappend result exec [info nameofexecutable]
if {[info exists env(GATEWAY_INTERFACE)]} then {
#
# NOTE: This option is required when calling
# out to the Fossil executable from a
# CGI process.
#
lappend result -nocgi
}
eval lappend result $args
if {[string length $repository] > 0} then {
#
# NOTE: This is almost certainly required
# when calling out to the Fossil
# executable on the server because
# there is almost never an open
# checkout.
#
lappend result -R $repository
}
if {[string length $user] > 0} then {
lappend result -U $user
}
# th1Eval [list html $result<br>]
return $result
}
}
}
proc getLatestTrunkCheckIn {} {
tclEval {
#
# NOTE: Get the unique Id of the latest check-in on trunk.
#
return [lindex [regexp -line -inline -nocase -- \
{^uuid:\s+([0-9A-F]{40}) } [eval [getFossilCommand \
$repository "" info trunk]]] end]
}
}
proc theSumOfAllFiles { id } {
#
# NOTE: Copy check-in Id value to the Tcl interpreter.
#
tclInvoke set id $id
tclEval {
set count 0
foreach line [split [eval [getFossilCommand \
$repository "" artifact $id]] \n] {
#
# NOTE: Is this an "F" (file) card?
#
if {[string range $line 0 1] eq "F "} then {
incr count
}
}
return $count
}
}
doSomeTclSetup; # perform some extra setup for the Tcl interpreter.
set checkIn [getLatestTrunkCheckIn]
set totalFiles [theSumOfAllFiles $checkIn]
</th1>
<br />
As of trunk check-in <th1>decorate \[$checkIn\]</th1>, this
repository contains <th1>html $totalFiles</th1> files.
<br />
|
Changes to test/tester.tcl.
| ︙ | ︙ | |||
326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
set line [string range $line 0 $i]$stuff[string range $line $ip1 end]
}
}
append out \n$line
}
return [string range $out 1 end]
}
protInit $fossilexe
foreach testfile $argv {
set dir [file root [file tail $testfile]]
file delete -force $dir
file mkdir $dir
set origwd [pwd]
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
set line [string range $line 0 $i]$stuff[string range $line $ip1 end]
}
}
append out \n$line
}
return [string range $out 1 end]
}
# Executes the "fossil http" command. The entire content of the HTTP request
# is read from the data file name, with [subst] being performed on it prior to
# submission. Temporary input and output files are created and deleted. The
# result will be the contents of the temoprary output file.
proc test_fossil_http { repository dataFileName url } {
set suffix [appendArgs [pid] - [getSeqNo] - [clock seconds] .txt]
set inFileName [file join $::tempPath [appendArgs test-http-in- $suffix]]
set outFileName [file join $::tempPath [appendArgs test-http-out- $suffix]]
set data [subst [read_file $dataFileName]]
write_file $inFileName $data
fossil http $inFileName $outFileName 127.0.0.1 $repository --localauth
set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}]
if {1} then {
catch {file delete $inFileName}
catch {file delete $outFileName}
}
return $result
}
# obtains and increments a "sequence number" for this test run.
proc getSeqNo {} {
upvar #0 seqNo seqNo
if {![info exists seqNo]} {
set seqNo 0
}
return [incr seqNo]
}
# fixup the whitespace in the result to make it easier to compare.
proc normalize_result {} {
return [string map [list \r\n \n] [string trim $::RESULT]]
}
# returns the first line of the normalized result.
proc first_data_line {} {
return [lindex [split [normalize_result] \n] 0]
}
# returns the second line of the normalized result.
proc second_data_line {} {
return [lindex [split [normalize_result] \n] 1]
}
# returns the third line of the normalized result.
proc third_data_line {} {
return [lindex [split [normalize_result] \n] 2]
}
# returns the last line of the normalized result.
proc last_data_line {} {
return [lindex [split [normalize_result] \n] end]
}
# returns the second to last line of the normalized result.
proc next_to_last_data_line {} {
return [lindex [split [normalize_result] \n] end-1]
}
# returns the third to last line of the normalized result.
proc third_to_last_data_line {} {
return [lindex [split [normalize_result] \n] end-2]
}
protInit $fossilexe
foreach testfile $argv {
set dir [file root [file tail $testfile]]
file delete -force $dir
file mkdir $dir
set origwd [pwd]
|
| ︙ | ︙ |
Added test/th1-docs-input.txt.
> > > > | 1 2 3 4 |
GET ${url} HTTP/1.1
Host: localhost
User-Agent: Fossil
|
Added test/th1-docs.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#
# Copyright (c) 2015 D. Richard Hipp
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the Simplified BSD License (also
# known as the "2-Clause License" or "FreeBSD License".)
#
# This program is distributed in the hope that it will be useful,
# but without any warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose.
#
# Author contact information:
# drh@hwaci.com
# http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Docs
#
fossil test-th-eval "hasfeature th1Docs"
if {$::RESULT ne "1"} then {
puts "Fossil was not compiled with TH1 docs support."; return
}
fossil test-th-eval "hasfeature tcl"
if {$::RESULT ne "1"} then {
puts "Fossil was not compiled with Tcl support."; return
}
###############################################################################
set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
###############################################################################
set data [fossil info]
regexp -line -- {^repository: (.*)$} $data dummy repository
if {[string length $repository] == 0 || ![file exists $repository]} then {
error "unable to locate repository"
}
set dataFileName [file join $::testdir th1-docs-input.txt]
###############################################################################
set RESULT [test_fossil_http \
$repository $dataFileName /doc/trunk/test/fileStat.th1]
test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]}
test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
|
Changes to test/th1-hooks.test.
| ︙ | ︙ | |||
26 27 28 29 30 31 32 | ############################################################################### set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. ############################################################################### | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
###############################################################################
set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
###############################################################################
set testTh1Setup {
proc initialize_hook_log {} {
if {![info exists ::hook_log]} {
set ::hook_log ""
}
}
|
| ︙ | ︙ | |||
101 102 103 104 105 106 107 |
} elseif {$::cmd_name eq "test3"} {
emit_hook_log
break "TH_BREAK return code"
} elseif {$::cmd_name eq "test4"} {
emit_hook_log
return -code 2 "TH_RETURN return code"
} elseif {$::cmd_name eq "timeline"} {
| | > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
} elseif {$::cmd_name eq "test3"} {
emit_hook_log
break "TH_BREAK return code"
} elseif {$::cmd_name eq "test4"} {
emit_hook_log
return -code 2 "TH_RETURN return code"
} elseif {$::cmd_name eq "timeline"} {
set length [llength $::cmd_args]
set length [expr {$length - 1}]
if {[lindex $::cmd_args $length] eq "custom"} {
emit_hook_log
return "custom timeline"
} elseif {[lindex $::cmd_args $length] eq "now"} {
emit_hook_log
return "now timeline"
} else {
emit_hook_log
error "unsupported timeline"
}
}
}
|
| ︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
set data [fossil info]
regexp -line -- {^repository: (.*)$} $data dummy repository
if {[string length $repository] == 0 || ![file exists $repository]} then {
error "unable to locate repository"
}
###############################################################################
saveTh1SetupFile; writeTh1SetupFile $testTh1Setup
###############################################################################
fossil timeline custom; # NOTE: Bad "WHEN" argument.
| > > | | | > > > > > > > > > > | > > > > > | > | > | > | > | > | > > | > | > | 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
set data [fossil info]
regexp -line -- {^repository: (.*)$} $data dummy repository
if {[string length $repository] == 0 || ![file exists $repository]} then {
error "unable to locate repository"
}
set dataFileName [file join $::testdir th1-hooks-input.txt]
###############################################################################
saveTh1SetupFile; writeTh1SetupFile $testTh1Setup
###############################################################################
fossil timeline custom; # NOTE: Bad "WHEN" argument.
test th1-cmd-hooks-1a {[normalize_result] eq \
{<h1><b>command_hook timeline</b></h1>
+++ no more data (0) +++
<h1><b>command_hook timeline command_notify timeline</b></h1>}}
###############################################################################
fossil timeline
test th1-cmd-hooks-2a {[first_data_line] eq \
{<h1><b>command_hook timeline</b></h1>}}
test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
###############################################################################
fossil timeline now
test th1-cmd-hooks-3a {[first_data_line] eq \
{<h1><b>command_hook timeline</b></h1>}}
test th1-cmd-hooks-3b \
{[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
test th1-cmd-hooks-3c \
{[regexp -- {--- line limit \(\d+\) reached ---} [third_to_last_data_line]]}
test th1-cmd-hooks-3d {[last_data_line] eq \
{<h1><b>command_hook timeline command_notify timeline</b></h1>}}
###############################################################################
fossil test1
test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
test th1-custom-cmd-1b {[last_data_line] eq \
{<h1><b>command_hook test1 command_notify test1</b></h1>}}
###############################################################################
fossil test2
test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
###############################################################################
fossil test3
test th1-custom-cmd-3a {[string trim $RESULT] eq \
{<h1><b>command_hook test3</b></h1>}}
###############################################################################
fossil test4
test th1-custom-cmd-4a {[string trim $RESULT] eq \
{<h1><b>command_hook test4</b></h1>}}
###############################################################################
set RESULT [test_fossil_http $repository $dataFileName /timeline]
test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
test th1-web-hooks-1b {[regexp [appendArgs \
{<h1><b>command_hook http webpage_hook timeline} " " \
{webpage_notify timeline</b></h1>}] $RESULT]}
###############################################################################
set RESULT [test_fossil_http $repository $dataFileName /test1]
test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
test th1-custom-web-1b {[last_data_line] eq \
{<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
###############################################################################
restoreTh1SetupFile
|
Changes to win/Makefile.mingw.
| ︙ | ︙ | |||
148 149 150 151 152 153 154 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2a OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
| ︙ | ︙ |
Changes to win/Makefile.mingw.mistachkin.
| ︙ | ︙ | |||
57 58 59 60 61 62 63 | #### Enable legacy treatment of mv/rm (skip checkout files) # FOSSIL_ENABLE_LEGACY_MV_RM = 1 #### Enable TH1 scripts in embedded documentation files # | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #### Enable legacy treatment of mv/rm (skip checkout files) # FOSSIL_ENABLE_LEGACY_MV_RM = 1 #### Enable TH1 scripts in embedded documentation files # FOSSIL_ENABLE_TH1_DOCS = 1 #### Enable hooks for commands and web pages via TH1 # FOSSIL_ENABLE_TH1_HOOKS = 1 #### Enable scripting support via Tcl/Tk # |
| ︙ | ︙ | |||
148 149 150 151 152 153 154 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2a OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
| ︙ | ︙ |
Changes to win/Makefile.msc.
| ︙ | ︙ | |||
56 57 58 59 60 61 62 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL SSLDIR = $(B)\compat\openssl-1.0.2a SSLINCDIR = $(SSLDIR)\inc32 SSLLIBDIR = $(SSLDIR)\out32 SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... # BUGBUG (OpenSSL): Apparently, using "no-ssl*" here breaks the build. |
| ︙ | ︙ |
Changes to www/build.wiki.
| ︙ | ︙ | |||
123 124 125 126 127 128 129 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. "<b>compat/openssl-1.0.2a</b>"), then make sure that some recent <a href="http://www.perl.org/">Perl</a> binaries are installed locally, and finally run one of the following commands: <blockquote><pre> nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin </pre></blockquote> <blockquote><pre> buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin |
| ︙ | ︙ |
Changes to www/changes.wiki.
1 2 3 4 5 6 7 8 9 |
<title>Change Log</title>
<h2>Changes for Version 1.32 (2015-03-14)</h2>
* When creating a new repository using [/help?cmd=init|fossil init], ensure
that the new repository is fully compatible with historical versions of
Fossil by having a valid manifest as RID 1.
* Anti-aliased rendering of arrowheads on timeline graphs.
* Added vi/less-style key bindings to the --tk diff GUI.
* Documentation updates to fix spellings and changes all "checkins" to
| > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
<title>Change Log</title>
<h2>Changes for Version 1.33 (not released yet)</h2>
* Add [/help?cmd=import|fossil import --svn], for importing a subversion
repository into fossil which was exported using "svnadmin dump".
<h2>Changes for Version 1.32 (2015-03-14)</h2>
* When creating a new repository using [/help?cmd=init|fossil init], ensure
that the new repository is fully compatible with historical versions of
Fossil by having a valid manifest as RID 1.
* Anti-aliased rendering of arrowheads on timeline graphs.
* Added vi/less-style key bindings to the --tk diff GUI.
* Documentation updates to fix spellings and changes all "checkins" to
|
| ︙ | ︙ |
Changes to www/sync.wiki.
| ︙ | ︙ | |||
245 246 247 248 249 250 251 | <blockquote> <b>push</b> <i>servercode projectcode</i><br> <b>pull</b> <i>servercode projectcode</i> </blockquote> <p>The <i>servercode</i> argument is the repository ID for the | < < | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | <blockquote> <b>push</b> <i>servercode projectcode</i><br> <b>pull</b> <i>servercode projectcode</i> </blockquote> <p>The <i>servercode</i> argument is the repository ID for the client. The <i>projectcode</i> is the identifier of the software project that the client repository contains. The projectcode for the client and server must match in order for the transaction to proceed.</p> <p>The server will also send a push card back to the client during a clone. This is how the client determines what project code to put in the new repository it is constructing.</p> |
| ︙ | ︙ | |||
382 383 384 385 386 387 388 | <p>The reqconfig card is normally sent in response to the "fossil configuration pull" command. The format is as follows: <blockquote> <b>reqconfig</b> <i>configuration-name</i> </blockquote> | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | <p>The reqconfig card is normally sent in response to the "fossil configuration pull" command. The format is as follows: <blockquote> <b>reqconfig</b> <i>configuration-name</i> </blockquote> <p>As of [/timeline?r=trunk&c=2015-03-19+03%3A57%3A46&n=20|2015-03-19], the configuration-name must be one of the following values: <center><table border=0> <tr><td valign="top"> <ul> <li> css <li> header |
| ︙ | ︙ | |||
418 419 420 421 422 423 424 425 426 427 428 | <ul></td><td valign="top"><ul> <li> ignore-glob <li> keep-glob <li> crnl-glob <li> encoding-glob <li> empty-dirs <li> allow-symlinks <li> ticket-table <li> ticket-common <li> ticket-change <li> ticket-newpage | > < > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | <ul></td><td valign="top"><ul> <li> ignore-glob <li> keep-glob <li> crnl-glob <li> encoding-glob <li> empty-dirs <li> allow-symlinks <li> dotfiles <li> ticket-table <li> ticket-common <li> ticket-change <li> ticket-newpage <ul></td><td valign="top"><ul> <li> ticket-viewpage <li> ticket-editpage <li> ticket-reportlist <li> ticket-report-template <li> ticket-key-template <li> ticket-title-expr <li> ticket-closed-expr <li> @reportfmt |
| ︙ | ︙ |