Fossil

Check-in [98fe1d88]
Login

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

Overview
Comment:Enhance the /test-rename-list page to show only distinct rename operations by default, with an option to show them all with the all=1 query parameter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:98fe1d88f31916379a4ff6899b303d1130ea5db8d1deaa88dd2fbc6034a1a28c
User & Date: drh 2018-05-05 17:37:52
Context
2018-05-05
17:47
Make the table generated by /test-rename-list sortable. check-in: 80ec9d53 user: drh tags: trunk
17:37
Enhance the /test-rename-list page to show only distinct rename operations by default, with an option to show them all with the all=1 query parameter. check-in: 98fe1d88 user: drh tags: trunk
11:30
Update the built-in SQLite to the latest 3.24.0 alpha. check-in: 58a64102 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/path.c.

559
560
561
562
563
564
565


















566
567
568
569
570
571
572
573
574
575
576
577
578

579
580







581
582
583
584
585
586
587
588
589
590
591
592
593
@    AND F.fnid=mlink.pfnid
@    AND T.fnid=mlink.fnid
@    AND event.objid=mlink.mid
@    AND event.type='ci'
@    AND blob.rid=mlink.mid
@  ORDER BY 1 DESC, 2;
;



















/*
** WEBPAGE: test-rename-list
**
** Print a list of all file rename operations throughout history.
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }

  style_header("List Of File Name Changes");
  @ <h3>NB: Experimental Page</h3>







  @ <table border="1" width="100%%">
  @ <tr><th>Date &amp; Time</th>
  @ <th>Old Name</th>
  @ <th>New Name</th>
  @ <th>Check-in</th></tr>
  db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/);
  while( db_step(&q)==SQLITE_ROW ){
    const char *zDate = db_column_text(&q, 0);
    const char *zOld = db_column_text(&q, 1);
    const char *zNew = db_column_text(&q, 2);
    const char *zUuid = db_column_text(&q, 3);
    @ <tr>
    @ <td>%z(href("%R/timeline?c=%t",zDate))%s(zDate)</a></td>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













>
|
<
>
>
>
>
>
>
>





<







559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598

599
600
601
602
603
604
605
606
607
608
609
610

611
612
613
614
615
616
617
@    AND F.fnid=mlink.pfnid
@    AND T.fnid=mlink.fnid
@    AND event.objid=mlink.mid
@    AND event.type='ci'
@    AND blob.rid=mlink.mid
@  ORDER BY 1 DESC, 2;
;

/* Query to extract distinct rename operations */
static const char zDistinctRenameQuery[] =
@ SELECT
@     min(datetime(event.mtime)),
@     F.name AS old_name,
@     T.name AS new_name,
@     blob.uuid
@   FROM mlink, filename F, filename T, event, blob
@  WHERE coalesce(mlink.pfnid,0)!=0 AND mlink.pfnid!=mlink.fnid
@    AND F.fnid=mlink.pfnid
@    AND T.fnid=mlink.fnid
@    AND event.objid=mlink.mid
@    AND event.type='ci'
@    AND blob.rid=mlink.mid
@  GROUP BY 2, 3
@  ORDER BY 1 DESC, 2;
;

/*
** WEBPAGE: test-rename-list
**
** Print a list of all file rename operations throughout history.
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
  Stmt q;

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  if( P("all")!=0 ){
    style_header("List Of All File Name Changes");

    db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/);
    style_submenu_element("Distinct", "%R/test-rename-list");
  }else{
    style_header("List Of Distinct File Name Changes");
    db_prepare(&q, "%s", zDistinctRenameQuery/*safe-for-%s*/);
    style_submenu_element("All", "%R/test-rename-list?all");
  }
  @ <table border="1" width="100%%">
  @ <tr><th>Date &amp; Time</th>
  @ <th>Old Name</th>
  @ <th>New Name</th>
  @ <th>Check-in</th></tr>

  while( db_step(&q)==SQLITE_ROW ){
    const char *zDate = db_column_text(&q, 0);
    const char *zOld = db_column_text(&q, 1);
    const char *zNew = db_column_text(&q, 2);
    const char *zUuid = db_column_text(&q, 3);
    @ <tr>
    @ <td>%z(href("%R/timeline?c=%t",zDate))%s(zDate)</a></td>