Documentation Source Text

Check-in [d3fa7ece9a]
Login

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

Overview
Comment:Enhance the chronology.html page so that the table columns are sortable.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d3fa7ece9a2fdc58689eb4ae546f7819e7f314c76b274fb32492444e2fbbd60d
User & Date: drh 2017-07-31 14:16:44
Context
2017-07-31
20:19
Mention the column-name fix in the change log for 3.20.0. check-in: 86057a37ce user: drh tags: trunk
14:16
Enhance the chronology.html page so that the table columns are sortable. check-in: d3fa7ece9a user: drh tags: trunk
2017-07-30
20:28
Fix a broken link to the A350 on the Well-Known users page. check-in: aa249826dc user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/changes.in.

    17     17   proc chng {date desc {options {}}} {
    18     18     global nChng aChng xrefChng
    19     19     set aChng($nChng) [list $date $desc $options]
    20     20     set xrefChng($date) $nChng
    21     21     incr nChng
    22     22   }
    23     23   
    24         -chng {2017-07-26 (3.20.0)} {
           24  +chng {2017-08-01 (3.20.0)} {
    25     25   <li> Update the text of error messages returned by [sqlite3_errmsg()] for some
    26     26        error codes.
    27     27   <li> Add new [pointer passing interfaces].
    28     28   <li> Backwards-incompatible changes to some extensions in order to take 
    29     29        advantage of the improved security offered by the new 
    30     30        [pointer passing interfaces]:
    31     31        <ul>
................................................................................
   104    104   <li> Ensure that the query planner knows that any column of a 
   105    105        [flattening optimization|flattened] LEFT JOIN can be NULL even 
   106    106        if that column is labeled with "NOT NULL". Fix for ticket 
   107    107        [https://sqlite.org/src/info/892fc34f173e99d8|892fc34f173e99d8].
   108    108   <li> Fix rare false-positives in [PRAGMA integrity_check] when run on a database connection
   109    109        with [ATTACH|attached databases]. Ticket
   110    110        [https://sqlite.org/src/info/a4e06e75a9ab61a12|a4e06e75a9ab61a12]
          111  +<li> Fix a bug (discovered by OSSFuzz) that causes an assertion fault if certain
          112  +     dodgy CREATE TABLE declarations are used.  Ticket
          113  +     [https://sqlite.org/src/info/bc115541132dad136|bc115541132dad136]
   111    114   }
   112    115   
   113    116   chng {2017-06-17 (3.18.2)} {
   114    117   <li>Fix a bug that might cause duplicate output rows when an IN operator is
   115    118       used in the WHERE clause.
   116    119       Ticket [https://sqlite.org/src/info/61fe9745|61fe9745].
   117    120   <p><b>Hashes:</b>

Changes to pages/chronology.in.

     1      1   <title>History Of SQLite Releases</title>
     2      2   <tcl>hd_keywords {chronology} {prior releases}</tcl>
     3      3   <h1 align=center>History Of SQLite Releases</h1>
     4      4   
     5      5   <center>
     6         -<table border=0 cellspacing=0>
            6  +<table border=0 cellspacing=0 id='chrontab'>
     7      7   <thead>
     8         -<tr><th>Date<th><th align='left'>Version
            8  +<tr><th class='sort desc'>Date<th class='sort none'>Version
     9      9   </thead>
    10     10   <tbody>
    11     11   <tcl>
    12     12   set nRelease 0
    13     13   set mxDate {1970-01-01}
    14     14   set mnDate {2999-12-31}
    15     15   # The following data was originally generated on 2016-09-03 using an
................................................................................
    24     24   #    ORDER BY mtime DESC;
    25     25   #
    26     26   # A small amount of manual editing and de-duplication followed.
    27     27   #
    28     28   # Manually edit the list for each subsequent release.
    29     29   #      
    30     30   foreach line [split {
    31         -xxxxxxxxxx|pending|version 3.20.0
    32         -036ebf729e|2017-06-17|version 3.18.2
    33         -77bb46233d|2017-06-16|version 3.18.1
    34         -0ee482a1e0|2017-06-08|version 3.19.3
    35         -edb4e819b0|2017-05-25|version 3.19.2
    36         -f6d7b988f4|2017-05-24|version 3.19.1
    37         -28a94eb282|2017-05-22|version 3.19.0
    38         -424a0d3803|2017-03-28|version 3.18.0
    39         -ada05cfa86|2017-02-13|version 3.17.0
    40         -a65a62893c|2017-01-06|version 3.16.2
           31  +xxxxxxxxxx|pending|Version 3.20.0
           32  +036ebf729e|2017-06-17|Version 3.18.2
           33  +77bb46233d|2017-06-16|Version 3.18.1
           34  +0ee482a1e0|2017-06-08|Version 3.19.3
           35  +edb4e819b0|2017-05-25|Version 3.19.2
           36  +f6d7b988f4|2017-05-24|Version 3.19.1
           37  +28a94eb282|2017-05-22|Version 3.19.0
           38  +424a0d3803|2017-03-28|Version 3.18.0
           39  +ada05cfa86|2017-02-13|Version 3.17.0
           40  +a65a62893c|2017-01-06|Version 3.16.2
    41     41   979f043928|2017-01-03|Version 3.16.1
    42     42   04ac0b75b1|2017-01-02|Version 3.16.0
    43     43   bbd85d235f|2016-11-28|Version 3.15.2
    44     44   1136863c76|2016-11-04|Version 3.15.1
    45     45   707875582f|2016-10-14|Version 3.15.0
    46     46   29dbef4b85|2016-09-12|Version 3.14.2
    47     47   a12d805977|2016-08-11|Version 3.14.1
................................................................................
   313    313   e8521fc10d|2000-08-18|Version 1.0.1 (CVS 498)
   314    314   f37dd18e3f|2000-08-17|Version 1.0 (CVS 499)
   315    315   } \n] {
   316    316     if {[string trim $line]==""} continue
   317    317     foreach {uuid date vers1} [split $line |] break
   318    318     regexp {[123]\.[0-9.]+} $vers1 vers
   319    319     set vers [string trim $vers .]
          320  +  set vlist [split $vers .]
          321  +  set vnum [expr {1000000*[lindex $vlist 0]+10000*[lindex $vlist 1]}]
          322  +  if {[lindex $vlist 2]!=""} {
          323  +    incr vnum [expr {100*[lindex $vlist 2]}]
          324  +    if {[lindex $vlist 3]!=""} {
          325  +      incr vnum [lindex $vlist 3]
          326  +    }
          327  +  }
   320    328     set dateofversion($vers) $date
   321    329     hd_puts "<tr>"
   322    330     if {[regexp {\d\d\d\d-\d\d-\d\d} $date]} {
   323    331       set url https://www.sqlite.org/src/timeline
   324    332       append url ?c=$uuid&y=ci
   325         -    hd_puts "<td><a href='$url'>$date</a></td>\n"
          333  +    hd_puts "<td width='100' align='center'><a href='$url'>$date</a></td>\n"
   326    334       if {$date>$mxDate} {set mxDate $date}
   327    335       if {$date<$mnDate} {set mnDate $date}
   328    336     } else {
   329         -    hd_puts "<td>$date</td>\n"
          337  +    hd_puts "<td width='100' align='center'>$date</td>\n"
   330    338     }
   331    339     incr nRelease
   332         -  hd_puts "<td width='20'></td>\n"
          340  +  hd_puts "<td width='100' align='center' data-sortkey='$vnum'>"
   333    341     if {[info exists "glink(version $vers)"]} {
   334         -    hd_resolve "<td>\[version $vers|$vers\]</td></tr>\n"
          342  +    hd_resolve "\[version $vers|$vers\]</td></tr>\n"
   335    343     } else {
   336         -    hd_puts "<td>$vers</td></tr>\n"
          344  +    hd_puts "$vers</td></tr>\n"
   337    345     }
   338    346   }
   339    347   </tcl>
          348  +</tbody>
   340    349   </table>
          350  +<tcl>
          351  +hd_puts {<script>
          352  +function SortableTable(tableEl,columnTypes,initSort){
          353  +  this.tbody = tableEl.getElementsByTagName('tbody');
          354  +  this.columnTypes = columnTypes;
          355  +  var ncols = tableEl.rows[0].cells.length;
          356  +  for(var i = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';}
          357  +  this.sort = function (cell) {
          358  +    var column = cell.cellIndex;
          359  +    var sortFn;
          360  +    switch( cell.sortType ){
          361  +      case "n": sortFn = this.sortNumeric;  break;
          362  +      case "t": sortFn = this.sortText;  break;
          363  +      case "T": sortFn = this.sortReverseText;  break;
          364  +      case "k": sortFn = this.sortKey;  break;
          365  +      case "K": sortFn = this.sortReverseKey;  break;
          366  +      default:  return;
          367  +    }
          368  +    this.sortIndex = column;
          369  +    var newRows = new Array();
          370  +    for (j = 0; j < this.tbody[0].rows.length; j++) {
          371  +       newRows[j] = this.tbody[0].rows[j];
          372  +    }
          373  +    if( this.sortIndex==Math.abs(this.prevColumn)-1 ){
          374  +      newRows.reverse();
          375  +      this.prevColumn = -this.prevColumn;
          376  +    }else{
          377  +      newRows.sort(sortFn);
          378  +      this.prevColumn = this.sortIndex+1;
          379  +    }
          380  +    for (i=0;i<newRows.length;i++) {
          381  +      this.tbody[0].appendChild(newRows[i]);
          382  +    }
          383  +    this.setHdrIcons();
          384  +  }
          385  +  this.setHdrIcons = function() {
          386  +    for (var i=0; i<this.hdrRow.cells.length; i++) {
          387  +      if( this.columnTypes[i]=='x' ) continue;
          388  +      var sortType;
          389  +      if( this.prevColumn==i+1 ){
          390  +        sortType = 'asc';
          391  +      }else if( this.prevColumn==(-1-i) ){
          392  +        sortType = 'desc'
          393  +      }else{
          394  +        sortType = 'none';
          395  +      }
          396  +      var hdrCell = this.hdrRow.cells[i];
          397  +      var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, '');
          398  +      clsName += ' sort ' + sortType;
          399  +      hdrCell.className = clsName;
          400  +    }
          401  +  }
          402  +  this.sortText = function(a,b) {
          403  +    var i = thisObject.sortIndex;
          404  +    aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
          405  +    bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
          406  +    if(aa<bb) return -1;
          407  +    if(aa==bb) return a.rowIndex-b.rowIndex;
          408  +    return 1;
          409  +  }
          410  +  this.sortReverseText = function(a,b) {
          411  +    var i = thisObject.sortIndex;
          412  +    aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
          413  +    bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
          414  +    if(aa<bb) return +1;
          415  +    if(aa==bb) return a.rowIndex-b.rowIndex;
          416  +    return -1;
          417  +  }
          418  +  this.sortNumeric = function(a,b) {
          419  +    var i = thisObject.sortIndex;
          420  +    aa = parseFloat(a.cells[i].textContent);
          421  +    if (isNaN(aa)) aa = 0;
          422  +    bb = parseFloat(b.cells[i].textContent);
          423  +    if (isNaN(bb)) bb = 0;
          424  +    if(aa==bb) return a.rowIndex-b.rowIndex;
          425  +    return aa-bb;
          426  +  }
          427  +  this.sortKey = function(a,b) {
          428  +    var i = thisObject.sortIndex;
          429  +    aa = a.cells[i].getAttribute("data-sortkey");
          430  +    bb = b.cells[i].getAttribute("data-sortkey");
          431  +    if(aa<bb) return -1;
          432  +    if(aa==bb) return a.rowIndex-b.rowIndex;
          433  +    return 1;
          434  +  }
          435  +  this.sortReverseKey = function(a,b) {
          436  +    var i = thisObject.sortIndex;
          437  +    aa = a.cells[i].getAttribute("data-sortkey");
          438  +    bb = b.cells[i].getAttribute("data-sortkey");
          439  +    if(aa<bb) return +1;
          440  +    if(aa==bb) return a.rowIndex-b.rowIndex;
          441  +    return -1;
          442  +  }
          443  +  var x = tableEl.getElementsByTagName('thead');
          444  +  if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
          445  +    return;
          446  +  }
          447  +  if(x && x[0].rows && x[0].rows.length > 0) {
          448  +    this.hdrRow = x[0].rows[0];
          449  +  } else {
          450  +    return;
          451  +  }
          452  +  var thisObject = this;
          453  +  this.prevColumn = initSort;
          454  +  for (var i=0; i<this.hdrRow.cells.length; i++) {
          455  +    if( columnTypes[i]=='x' ) continue;
          456  +    var hdrcell = this.hdrRow.cells[i];
          457  +    hdrcell.sTable = this;
          458  +    hdrcell.style.cursor = "pointer";
          459  +    hdrcell.sortType = columnTypes[i] || 't';
          460  +    hdrcell.onclick = function () {
          461  +      this.sTable.sort(this);
          462  +      return false;
          463  +    }
          464  +  }
          465  +  this.setHdrIcons()
          466  +}
          467  +var t = new SortableTable(document.getElementById("chrontab"),"TK",1);
          468  +</script>
          469  +}</tcl>
   341    470   <p>
   342    471   <tcl>
   343    472   set nDay [db eval {SELECT julianday($mxDate)-julianday($mnDate)}]
   344    473   hd_putsnl "<i>$nRelease releases"
   345    474   hd_putsnl "over [format %.1f [expr {$nDay/365.24}]] years.</i>"
   346    475   </tcl>

Changes to rawpages/sqlite.css.

   260    260   }
   261    261   
   262    262   .footer {
   263    263     padding-top: 2px;
   264    264     padding-bottom: 1px;
   265    265     border-top: 2px solid #044a64;
   266    266   }
          267  +
          268  +th.sort:after {
          269  +  margin-left: .4em;
          270  +  cursor: pointer;
          271  +  text-shadow: 0 0 0 #000; /* Makes arrow darker */
          272  +}
          273  +th.sort.none:after {
          274  +  content: '\2666';
          275  +}
          276  +th.sort.asc:after {
          277  +  content: '\2193';
          278  +}
          279  +th.sort.desc:after {
          280  +  content: '\2191'
          281  +}