Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add db_add_unsent() and replace numerous "INSERT OR IGNORE INTO unset" statements with that. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | forumpost-locking |
| Files: | files | file ages | folders |
| SHA3-256: |
98d4ee73d7f9a4ca393bdfd93ca8b13f |
| User & Date: | stephan 2023-02-21 09:52:46.948 |
Context
|
2023-02-21
| ||
| 10:30 | Initial (untested) code for creating the control artifact for closing and re-opening forum threads. Extend test-forumthread's tree view to show thread closure. check-in: 32fc62e681 user: stephan tags: forumpost-locking | |
| 09:52 | Add db_add_unsent() and replace numerous "INSERT OR IGNORE INTO unset" statements with that. check-in: 98d4ee73d7 user: stephan tags: forumpost-locking | |
| 08:47 | Coding style tweaks. check-in: 9fc70f6f63 user: stephan tags: forumpost-locking | |
Changes
Changes to src/attach.c.
| ︙ | ︙ | |||
242 243 244 245 246 247 248 |
moderation_table_create();
db_multi_exec(
"INSERT INTO modreq(objid,attachRid) VALUES(%d,%d);",
rid, attachRid
);
}else{
rid = content_put(pAttach);
| | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
moderation_table_create();
db_multi_exec(
"INSERT INTO modreq(objid,attachRid) VALUES(%d,%d);",
rid, attachRid
);
}else{
rid = content_put(pAttach);
db_add_unsent(rid);
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
}
manifest_crosslink(rid, pAttach, MC_NONE);
}
/*
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
191 192 193 194 195 196 197 |
}
}
brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
if( brid==0 ){
fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
}
| | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
}
}
brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
if( brid==0 ){
fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
}
db_add_unsent(brid);
if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){
fossil_fatal("%s", g.zErrMsg);
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, &brid, 1, 0);
zUuid = rid_to_uuid(brid);
fossil_print("New branch: %s\n", zUuid);
if( g.argc==3 ){
fossil_print(
"\n"
"Note: the local check-out has not been updated to the new\n"
" branch. To begin working on the new branch, do this:\n"
"\n"
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
fossil_fatal("Problem saving new artifact: %s\n%b",
g.zErrMsg, &manifest);
}else if(manifest_crosslink(newRid, &manifest, 0)==0){
fossil_fatal("Crosslinking error: %s", g.zErrMsg);
}
fossil_print("Saved new control artifact %z (RID %d).\n",
rid_to_uuid(newRid), newRid);
| | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
fossil_fatal("Problem saving new artifact: %s\n%b",
g.zErrMsg, &manifest);
}else if(manifest_crosslink(newRid, &manifest, 0)==0){
fossil_fatal("Crosslinking error: %s", g.zErrMsg);
}
fossil_print("Saved new control artifact %z (RID %d).\n",
rid_to_uuid(newRid), newRid);
db_add_unsent(newRid);
if(fDryRun){
fossil_print("Dry-run mode: rolling back new artifact.\n");
assert(0!=doRollback);
}
}
db_multi_exec("DROP TABLE brcmdtag");
blob_reset(&manifest);
|
| ︙ | ︙ | |||
717 718 719 720 721 722 723 |
" WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
}
branch_prepare_list_query(&q, brFlags, zBrNameGlob, nLimit);
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
int isPriv = zCurrent!=0 && db_column_int(&q, 1)==1;
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
| | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
" WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
}
branch_prepare_list_query(&q, brFlags, zBrNameGlob, nLimit);
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
int isPriv = zCurrent!=0 && db_column_int(&q, 1)==1;
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
fossil_print("%s%s%s\n",
( (brFlags & BRL_PRIVATE) ? " " : ( isPriv ? "#" : " ") ),
(isCur ? "* " : " "), zBr);
}
db_finalize(&q);
}else if( strncmp(zCmd,"new",n)==0 ){
branch_new();
}else if( strncmp(zCmd,"close",5)==0 ){
if(g.argc<4){
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
2661 2662 2663 2664 2665 2666 2667 |
blob_reset(&content);
if( nrid!=rid ){
if( rid>0 ){
content_deltify(rid, &nrid, 1, 0);
}
db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d",
nrid,nrid,id);
| | | 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 |
blob_reset(&content);
if( nrid!=rid ){
if( rid>0 ){
content_deltify(rid, &nrid, 1, 0);
}
db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d",
nrid,nrid,id);
db_add_unsent(nrid);
}
}
db_finalize(&q);
if( nConflict && !allowConflict ){
fossil_fatal("abort due to unresolved merge conflicts; "
"use --allow-conflict to override");
}else if( abortCommit ){
|
| ︙ | ︙ | |||
2759 2760 2761 2762 2763 2764 2765 |
free(zManifestFile);
}
nvid = content_put(&manifest);
if( nvid==0 ){
fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
}
| | | 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 |
free(zManifestFile);
}
nvid = content_put(&manifest);
if( nvid==0 ){
fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
}
db_add_unsent(nvid);
if( manifest_crosslink(nvid, &manifest,
dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){
fossil_fatal("%s", g.zErrMsg);
}
assert( blob_is_reset(&manifest) );
content_deltify(vid, &nvid, 1, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
5109 5110 5111 5112 5113 5114 5115 |
zRepo = db_fingerprint(atoi(zCkout), 0);
rc = fossil_strcmp(zCkout,zRepo)==0;
fossil_free(zRepo);
}
fossil_free(zCkout);
return rc;
}
| > > > > > > > | 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 |
zRepo = db_fingerprint(atoi(zCkout), 0);
rc = fossil_strcmp(zCkout,zRepo)==0;
fossil_free(zRepo);
}
fossil_free(zCkout);
return rc;
}
/*
** Adds the given rid to the UNSENT table.
*/
void db_add_unsent(int rid){
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", rid);
}
|
Changes to src/event.c.
| ︙ | ︙ | |||
326 327 328 329 330 331 332 |
blob_appendf(&event, "U %F\n", login_name());
}
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event);
| | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
blob_appendf(&event, "U %F\n", login_name());
}
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event);
db_add_unsent(nrid);
if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){
db_end_transaction(1);
return 0;
}
assert( blob_is_reset(&event) );
content_deltify(rid, &nrid, 1, 0);
db_end_transaction(0);
|
| ︙ | ︙ |
Changes to src/json_branch.c.
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
md5sum_blob(&branch, &mcksum);
blob_appendf(&branch, "Z %b\n", &mcksum);
brid = content_put_ex(&branch, 0, 0, 0, zOpt->isPrivate);
if( brid==0 ){
fossil_panic("Problem committing manifest: %s", g.zErrMsg);
}
| | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
md5sum_blob(&branch, &mcksum);
blob_appendf(&branch, "Z %b\n", &mcksum);
brid = content_put_ex(&branch, 0, 0, 0, zOpt->isPrivate);
if( brid==0 ){
fossil_panic("Problem committing manifest: %s", g.zErrMsg);
}
db_add_unsent(brid);
if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){
fossil_panic("%s", g.zErrMsg);
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, &brid, 1, 0);
if( zNewRid ){
*zNewRid = brid;
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
860 861 862 863 864 865 866 |
if( needMod ){
moderation_table_create();
db_multi_exec(
"INSERT INTO modreq(objid, tktid) VALUES(%d,%Q)",
rid, zTktId
);
}else{
| | | 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 |
if( needMod ){
moderation_table_create();
db_multi_exec(
"INSERT INTO modreq(objid, tktid) VALUES(%d,%Q)",
rid, zTktId
);
}else{
db_add_unsent(rid);
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
}
result = (manifest_crosslink(rid, pTicket, MC_NONE)==0);
assert( blob_is_reset(pTicket) );
if( !result ){
result = manifest_crosslink_end(MC_PERMIT_HOOKS);
}else{
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
633 634 635 636 637 638 639 |
nrid = content_put_ex(pWiki, 0, 0, 0, 0);
if( parent ) content_deltify(parent, &nrid, 1, 0);
}else{
nrid = content_put_ex(pWiki, 0, 0, 0, 1);
moderation_table_create();
db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid);
}
| | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
nrid = content_put_ex(pWiki, 0, 0, 0, 0);
if( parent ) content_deltify(parent, &nrid, 1, 0);
}else{
nrid = content_put_ex(pWiki, 0, 0, 0, 1);
moderation_table_create();
db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid);
}
db_add_unsent(nrid);
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid);
manifest_crosslink(nrid, pWiki, MC_NONE);
if( login_is_individual() ){
alert_user_contact(login_name());
}
return nrid;
}
|
| ︙ | ︙ |