Fossil

Check-in [cd4fdbed]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge the PLINK table enhancement into the DBP-workflow branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | DBP-workflow
Files: files | file ages | folders
SHA1: cd4fdbed05d9d583d48fca4441d6c37183f15811
User & Date: drh 2014-11-24 21:11:08
Context
2014-11-25
01:33
The "purge" and "purge list" commands appear to be working. check-in: 92de66d2 user: drh tags: DBP-workflow
2014-11-24
21:11
Merge the PLINK table enhancement into the DBP-workflow branch. check-in: cd4fdbed user: drh tags: DBP-workflow
21:04
Keep track of the baseline for delta manifests in the PLINK table. This is a schema change and requires a "fossil rebuild". check-in: f36ac49d user: drh tags: baseline-in-plink
20:33
More code for the purge command. The purge command still does not work. This is just an incremental check-in. check-in: 21113220 user: drh tags: DBP-workflow
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/manifest.c.

1772
1773
1774
1775
1776
1777
1778







1779
1780

1781
1782

1783
1784
1785
1786
1787
1788
1789
  if( p->type==CFTYPE_MANIFEST ){
    if( permitHooks ){
      zScript = xfer_commit_code();
      zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
    }
    if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
      char *zCom;







      for(i=0; i<p->nParent; i++){
        int pid = uuid_to_rid(p->azParent[i], 1);

        db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
                      "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);

        if( i==0 ){
          add_mlink(pid, 0, rid, p);
          parentid = pid;
        }
      }
      db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d AND isprim", rid);
      while( db_step(&q)==SQLITE_ROW ){







>
>
>
>
>
>
>


>
|
|
>







1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
  if( p->type==CFTYPE_MANIFEST ){
    if( permitHooks ){
      zScript = xfer_commit_code();
      zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
    }
    if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
      char *zCom;
      char zBaseId[30];
      if( p->zBaseline ){
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
                         uuid_to_rid(p->zBaseline,1));
      }else{
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
      }
      for(i=0; i<p->nParent; i++){
        int pid = uuid_to_rid(p->azParent[i], 1);
        db_multi_exec(
           "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
           "VALUES(%d, %d, %d, %.17g, %s)",
           pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
        if( i==0 ){
          add_mlink(pid, 0, rid, p);
          parentid = pid;
        }
      }
      db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d AND isprim", rid);
      while( db_step(&q)==SQLITE_ROW ){

Changes to src/schema.c.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
248
249
250
251
252
253
254

255
256
257
258
259
260
261
** The content tables have a content version number which rarely
** changes.  The aux tables have an arbitrary version number (typically
** a date) which can change frequently.  When the content schema changes,
** we have to execute special procedures to update the schema.  When
** the aux schema changes, all we need to do is rebuild the database.
*/
#define CONTENT_SCHEMA  "2"
#define AUX_SCHEMA      "2011-04-25 19:50"

#endif /* INTERFACE */


/*
** The schema for a repository database.
**
................................................................................
@ -- Parent/child linkages between checkins
@ --
@ CREATE TABLE plink(
@   pid INTEGER REFERENCES blob,    -- Parent manifest
@   cid INTEGER REFERENCES blob,    -- Child manifest
@   isprim BOOLEAN,                 -- pid is the primary parent of cid
@   mtime DATETIME,                 -- the date/time stamp on cid.  Julian day.

@   UNIQUE(pid, cid)
@ );
@ CREATE INDEX plink_i2 ON plink(cid,pid);
@
@ -- A "leaf" checkin is a checkin that has no children in the same
@ -- branch.  The set of all leaves is easily computed with a join,
@ -- between the plink and tagxref tables, but it is a slower join for







|







 







>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
** The content tables have a content version number which rarely
** changes.  The aux tables have an arbitrary version number (typically
** a date) which can change frequently.  When the content schema changes,
** we have to execute special procedures to update the schema.  When
** the aux schema changes, all we need to do is rebuild the database.
*/
#define CONTENT_SCHEMA  "2"
#define AUX_SCHEMA      "2014-11-24 20:35"

#endif /* INTERFACE */


/*
** The schema for a repository database.
**
................................................................................
@ -- Parent/child linkages between checkins
@ --
@ CREATE TABLE plink(
@   pid INTEGER REFERENCES blob,    -- Parent manifest
@   cid INTEGER REFERENCES blob,    -- Child manifest
@   isprim BOOLEAN,                 -- pid is the primary parent of cid
@   mtime DATETIME,                 -- the date/time stamp on cid.  Julian day.
@   baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
@   UNIQUE(pid, cid)
@ );
@ CREATE INDEX plink_i2 ON plink(cid,pid);
@
@ -- A "leaf" checkin is a checkin that has no children in the same
@ -- branch.  The set of all leaves is easily computed with a join,
@ -- between the plink and tagxref tables, but it is a slower join for