Fossil

Check-in [5a23a724ae]
Login

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

Overview
Comment:Include first-generation simple cherrypicks in ancestor graphs on the timeline.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5a23a724aef1f5027a912122288cef22cb80c7e4418af1f5a3b325a3f2b7ce2a
User & Date: drh 2020-06-17 14:38:11.732
Original Comment: Include first-generation simple cherrypicks among in ancestor graphs on the timeline.
Context
2020-06-17
17:18
Improved comments in the compute_ancestors() function. No code changes. check-in: c1abd612a9 user: drh tags: trunk
14:38
Include first-generation simple cherrypicks in ancestor graphs on the timeline. check-in: 5a23a724ae user: drh tags: trunk
2020-06-16
20:46
Search improvements: Limit the number of search results to the value in the "search-limit" setting, or 100 results if the setting is omitted. And, show the date of each article if the date is not included as part of the title. check-in: 13dfcdd957 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/descendants.c.
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
*/
void compute_ancestors(int rid, int N, int directOnly){
  if( !N ){
     N = -1;
  }else if( N<0 ){
     N = -N;
  }

  db_multi_exec(
    "WITH RECURSIVE "
    "  ancestor(rid, mtime) AS ("
    "    SELECT %d, mtime FROM event WHERE objid=%d "
    "    UNION "
    "    SELECT plink.pid, event.mtime"
    "      FROM ancestor, plink, event"
    "     WHERE plink.cid=ancestor.rid"
    "       AND event.objid=plink.pid %s"

    "     ORDER BY mtime DESC LIMIT %d"
    "  )"
    "INSERT INTO ok"
    "  SELECT rid FROM ancestor;",
    rid, rid, directOnly ? "AND plink.isPrim" : "", N
  );























}

/*
** Compute the youngest ancestor of record ID rid that is a member of
** branch zBranch.
*/
int compute_youngest_ancestor_in_branch(int rid, const char *zBranch){







>
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
*/
void compute_ancestors(int rid, int N, int directOnly){
  if( !N ){
     N = -1;
  }else if( N<0 ){
     N = -N;
  }
  if( directOnly ){
    db_multi_exec(
      "WITH RECURSIVE "
      "  ancestor(rid, mtime) AS ("
      "    SELECT %d, mtime FROM event WHERE objid=%d "
      "    UNION "
      "    SELECT plink.pid, event.mtime"
      "      FROM ancestor, plink, event"
      "     WHERE plink.cid=ancestor.rid"
      "       AND event.objid=plink.pid"
      "       AND plink.isPrim"
      "     ORDER BY mtime DESC LIMIT %d"
      "  )"
      "INSERT INTO ok"
      "  SELECT rid FROM ancestor;",
      rid, rid, N
    );
  }else{
    db_multi_exec(
      "WITH RECURSIVE "
      "  parent(pid,cid,isCP) AS ("
      "    SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink"
      "    UNION ALL"
      "    SELECT parentid, childid, 1 FROM cherrypick WHERE NOT isExclude"
      "  ),"
      "  ancestor(rid, mtime, isCP) AS ("
      "    SELECT %d, mtime, 0 FROM event WHERE objid=%d "
      "    UNION "
      "    SELECT parent.pid, event.mtime, parent.isCP"
      "      FROM ancestor, parent, event"
      "     WHERE parent.cid=ancestor.rid"
      "       AND event.objid=parent.pid"
      "       AND NOT ancestor.isCP"
      "     ORDER BY mtime DESC LIMIT %d"
      "  )"
      "INSERT INTO ok"
      "  SELECT rid FROM ancestor;",
      rid, rid, N
    );
  }
}

/*
** Compute the youngest ancestor of record ID rid that is a member of
** branch zBranch.
*/
int compute_youngest_ancestor_in_branch(int rid, const char *zBranch){