Artifact cd16841a59d7db2d0cca1723f729b262d1c1636d:
File
src/timeline.c
part of check-in
[66f4caa379]
- Improvements to the WWW interface.
by
drh on
2007-07-23 19:52:51.
0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 37 20 44 2e 20 52 69 63 68 (c) 2007 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76 lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65 ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69 ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 tributed in the
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20 l be useful,.**
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 but WITHOUT ANY
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20 RPOSE. See the
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50 GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20 d have received
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72 g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69 ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65 te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 ation, Inc., 59
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53 Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73 uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31 ton, MA 02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20 307, USA..**.**
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69 Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 nformation:.**
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68 * http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65 .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 74 contains code t
0380: 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 o implement the
0390: 74 69 6d 65 6c 69 6e 65 20 77 65 62 20 70 61 67 timeline web pag
03a0: 65 0a 2a 2a 0a 2a 2f 0a 23 69 6e 63 6c 75 64 65 e.**.*/.#include
03b0: 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e 63 "config.h".#inc
03c0: 6c 75 64 65 20 22 74 69 6d 65 6c 69 6e 65 2e 68 lude "timeline.h
03d0: 22 0a 0a 2f 2a 0a 2a 2a 20 47 65 6e 65 72 61 74 "../*.** Generat
03e0: 65 20 61 20 68 79 70 65 72 6c 69 6e 6b 20 74 6f e a hyperlink to
03f0: 20 61 20 76 65 72 73 69 6f 6e 2e 0a 2a 2f 0a 76 a version..*/.v
0400: 6f 69 64 20 68 79 70 65 72 6c 69 6e 6b 5f 74 6f oid hyperlink_to
0410: 5f 75 75 69 64 28 63 6f 6e 73 74 20 63 68 61 72 _uuid(const char
0420: 20 2a 7a 55 75 69 64 29 7b 0a 20 20 63 68 61 72 *zUuid){. char
0430: 20 7a 53 68 6f 72 74 55 75 69 64 5b 55 55 49 44 zShortUuid[UUID
0440: 5f 53 49 5a 45 2b 31 5d 3b 0a 20 20 73 70 72 69 _SIZE+1];. spri
0450: 6e 74 66 28 7a 53 68 6f 72 74 55 75 69 64 2c 20 ntf(zShortUuid,
0460: 22 25 2e 31 30 73 22 2c 20 7a 55 75 69 64 29 3b "%.10s", zUuid);
0470: 0a 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 73 . @ <a href="%s
0480: 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 76 69 6e (g.zBaseURL)/vin
0490: 66 6f 2f 25 73 28 7a 55 75 69 64 29 22 3e 5b 25 fo/%s(zUuid)">[%
04a0: 73 28 7a 53 68 6f 72 74 55 75 69 64 29 5d 3c 2f s(zShortUuid)]</
04b0: 61 3e 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 47 65 6e 65 a>.}../*.** Gene
04c0: 72 61 74 65 20 61 20 68 79 70 65 72 6c 69 6e 6b rate a hyperlink
04d0: 20 74 6f 20 61 20 64 69 66 66 20 62 65 74 77 65 to a diff betwe
04e0: 65 6e 20 74 77 6f 20 76 65 72 73 69 6f 6e 73 2e en two versions.
04f0: 0a 2a 2f 0a 76 6f 69 64 20 68 79 70 65 72 6c 69 .*/.void hyperli
0500: 6e 6b 5f 74 6f 5f 64 69 66 66 28 63 6f 6e 73 74 nk_to_diff(const
0510: 20 63 68 61 72 20 2a 7a 56 31 2c 20 63 6f 6e 73 char *zV1, cons
0520: 74 20 63 68 61 72 20 2a 7a 56 32 29 7b 0a 20 20 t char *zV2){.
0530: 69 66 28 20 7a 56 32 3d 3d 30 20 29 7b 0a 20 20 if( zV2==0 ){.
0540: 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 73 28 @ <a href="%s(
0550: 67 2e 7a 42 61 73 65 55 52 4c 29 2f 64 69 66 66 g.zBaseURL)/diff
0560: 3f 76 32 3d 25 73 28 7a 56 31 29 22 3e 5b 64 69 ?v2=%s(zV1)">[di
0570: 66 66 5d 3c 2f 61 3e 0a 20 20 7d 65 6c 73 65 7b ff]</a>. }else{
0580: 0a 20 20 20 20 40 20 3c 61 20 68 72 65 66 3d 22 . @ <a href="
0590: 25 73 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 64 %s(g.zBaseURL)/d
05a0: 69 66 66 3f 76 31 3d 25 73 28 7a 56 31 29 26 76 iff?v1=%s(zV1)&v
05b0: 32 3d 25 73 28 7a 56 32 29 22 3e 5b 64 69 66 66 2=%s(zV2)">[diff
05c0: 5d 3c 2f 61 3e 0a 20 20 7d 0a 7d 0a 0a 0a 2f 2a ]</a>. }.}.../*
05d0: 0a 2a 2a 20 57 45 42 50 41 47 45 3a 20 74 69 6d .** WEBPAGE: tim
05e0: 65 6c 69 6e 65 0a 2a 2f 0a 76 6f 69 64 20 70 61 eline.*/.void pa
05f0: 67 65 5f 74 69 6d 65 6c 69 6e 65 28 76 6f 69 64 ge_timeline(void
0600: 29 7b 0a 20 20 53 74 6d 74 20 71 3b 0a 20 20 63 ){. Stmt q;. c
0610: 68 61 72 20 7a 50 72 65 76 44 61 74 65 5b 32 30 har zPrevDate[20
0620: 5d 3b 0a 20 20 73 74 79 6c 65 5f 68 65 61 64 65 ];. style_heade
0630: 72 28 22 54 69 6d 65 6c 69 6e 65 22 29 3b 0a 20 r("Timeline");.
0640: 20 7a 50 72 65 76 44 61 74 65 5b 30 5d 20 3d 20 zPrevDate[0] =
0650: 30 3b 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 0;. db_prepare(
0660: 26 71 2c 0a 20 20 20 20 22 53 45 4c 45 43 54 20 &q,. "SELECT
0670: 75 75 69 64 2c 20 64 61 74 65 74 69 6d 65 28 65 uuid, datetime(e
0680: 76 65 6e 74 2e 6d 74 69 6d 65 2c 27 6c 6f 63 61 vent.mtime,'loca
0690: 6c 74 69 6d 65 27 29 2c 20 63 6f 6d 6d 65 6e 74 ltime'), comment
06a0: 22 0a 20 20 20 20 22 20 20 46 52 4f 4d 20 65 76 ". " FROM ev
06b0: 65 6e 74 2c 20 62 6c 6f 62 22 0a 20 20 20 20 22 ent, blob". "
06c0: 20 57 48 45 52 45 20 65 76 65 6e 74 2e 74 79 70 WHERE event.typ
06d0: 65 3d 27 63 69 27 20 41 4e 44 20 62 6c 6f 62 2e e='ci' AND blob.
06e0: 72 69 64 3d 65 76 65 6e 74 2e 6f 62 6a 69 64 22 rid=event.objid"
06f0: 0a 20 20 20 20 22 20 4f 52 44 45 52 20 42 59 20 . " ORDER BY
0700: 65 76 65 6e 74 2e 6d 74 69 6d 65 20 44 45 53 43 event.mtime DESC
0710: 22 0a 20 20 29 3b 0a 20 20 40 20 3c 74 61 62 6c ". );. @ <tabl
0720: 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 30 20 e cellspacing=0
0730: 62 6f 72 64 65 72 3d 30 20 63 65 6c 6c 70 61 64 border=0 cellpad
0740: 64 69 6e 67 3d 30 3e 0a 20 20 77 68 69 6c 65 28 ding=0>. while(
0750: 20 64 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 51 db_step(&q)==SQ
0760: 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 LITE_ROW ){.
0770: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 const char *zDat
0780: 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 e = db_column_te
0790: 78 74 28 26 71 2c 20 31 29 3b 0a 20 20 20 20 69 xt(&q, 1);. i
07a0: 66 28 20 6d 65 6d 63 6d 70 28 7a 44 61 74 65 2c f( memcmp(zDate,
07b0: 20 7a 50 72 65 76 44 61 74 65 2c 20 31 30 29 20 zPrevDate, 10)
07c0: 29 7b 0a 20 20 20 20 20 20 73 70 72 69 6e 74 66 ){. sprintf
07d0: 28 7a 50 72 65 76 44 61 74 65 2c 20 22 25 2e 31 (zPrevDate, "%.1
07e0: 30 73 22 2c 20 7a 44 61 74 65 29 3b 0a 20 20 20 0s", zDate);.
07f0: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 63 6f 6c @ <tr><td col
0800: 73 70 61 6e 3d 33 3e 0a 20 20 20 20 20 20 40 20 span=3>. @
0810: 3c 74 61 62 6c 65 20 63 65 6c 6c 70 61 64 64 69 <table cellpaddi
0820: 6e 67 3d 32 20 62 6f 72 64 65 72 3d 30 3e 0a 20 ng=2 border=0>.
0830: 20 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 62 @ <tr><td b
0840: 67 63 6f 6c 6f 72 3d 22 23 61 30 62 35 66 34 22 gcolor="#a0b5f4"
0850: 20 63 6c 61 73 73 3d 22 62 6f 72 64 65 72 31 22 class="border1"
0860: 3e 0a 20 20 20 20 20 20 40 20 3c 74 61 62 6c 65 >. @ <table
0870: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 32 20 63 cellpadding=2 c
0880: 65 6c 6c 73 70 61 63 69 6e 67 3d 30 20 62 6f 72 ellspacing=0 bor
0890: 64 65 72 3d 30 3e 3c 74 72 3e 0a 20 20 20 20 20 der=0><tr>.
08a0: 20 40 20 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 @ <td bgcolor="
08b0: 23 64 30 64 39 66 34 22 20 63 6c 61 73 73 3d 22 #d0d9f4" class="
08c0: 62 6b 67 6e 64 31 22 3e 25 73 28 7a 50 72 65 76 bkgnd1">%s(zPrev
08d0: 44 61 74 65 29 3c 2f 74 64 3e 0a 20 20 20 20 20 Date)</td>.
08e0: 20 40 20 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e @ </tr></table>
08f0: 0a 20 20 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f . @ </td></
0900: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 tr></table>.
0910: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
0920: 20 20 20 7d 0a 20 20 20 20 40 20 3c 74 72 3e 3c }. @ <tr><
0930: 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22 3e td valign="top">
0940: 25 73 28 26 7a 44 61 74 65 5b 31 31 5d 29 3c 2f %s(&zDate[11])</
0950: 74 64 3e 0a 20 20 20 20 40 20 3c 74 64 20 77 69 td>. @ <td wi
0960: 64 74 68 3d 22 32 30 22 3e 3c 2f 74 64 3e 0a 20 dth="20"></td>.
0970: 20 20 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d @ <td valign=
0980: 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 6c 65 66 "top" align="lef
0990: 74 22 3e 0a 20 20 20 20 68 79 70 65 72 6c 69 6e t">. hyperlin
09a0: 6b 5f 74 6f 5f 75 75 69 64 28 64 62 5f 63 6f 6c k_to_uuid(db_col
09b0: 75 6d 6e 5f 74 65 78 74 28 26 71 2c 30 29 29 3b umn_text(&q,0));
09c0: 0a 20 20 20 20 40 20 25 73 28 64 62 5f 63 6f 6c . @ %s(db_col
09d0: 75 6d 6e 5f 74 65 78 74 28 26 71 2c 32 29 29 3c umn_text(&q,2))<
09e0: 2f 74 64 3e 0a 20 20 7d 0a 20 20 64 62 5f 66 69 /td>. }. db_fi
09f0: 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 20 20 40 20 nalize(&q);. @
0a00: 3c 2f 74 61 62 6c 65 3e 0a 20 20 73 74 79 6c 65 </table>. style
0a10: 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d 0a 2f 2a 0a _footer();.}./*.
0a20: 2a 2a 20 54 68 65 20 69 6e 70 75 74 20 71 75 65 ** The input que
0a30: 72 79 20 71 20 73 65 6c 65 63 74 73 20 76 61 72 ry q selects var
0a40: 69 6f 75 73 20 72 65 63 6f 72 64 73 2e 20 20 50 ious records. P
0a50: 72 69 6e 74 20 61 20 68 75 6d 61 6e 2d 72 65 61 rint a human-rea
0a60: 64 61 62 6c 65 0a 2a 2a 20 73 75 6d 6d 61 72 79 dable.** summary
0a70: 20 6f 66 20 74 68 6f 73 65 20 72 65 63 6f 72 64 of those record
0a80: 73 2e 0a 2a 2a 0a 2a 2a 20 4c 69 6d 69 74 20 74 s..**.** Limit t
0a90: 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 65 6e 74 he number of ent
0aa0: 72 69 65 73 20 70 72 69 6e 74 65 64 20 74 6f 20 ries printed to
0ab0: 6e 4c 69 6e 65 2e 0a 2a 2f 0a 76 6f 69 64 20 70 nLine..*/.void p
0ac0: 72 69 6e 74 5f 74 69 6d 65 6c 69 6e 65 28 53 74 rint_timeline(St
0ad0: 6d 74 20 2a 71 2c 20 69 6e 74 20 6d 78 4c 69 6e mt *q, int mxLin
0ae0: 65 29 7b 0a 20 20 69 6e 74 20 6e 4c 69 6e 65 20 e){. int nLine
0af0: 3d 20 30 3b 0a 20 20 63 68 61 72 20 7a 50 72 65 = 0;. char zPre
0b00: 76 44 61 74 65 5b 32 30 5d 3b 0a 20 20 7a 50 72 vDate[20];. zPr
0b10: 65 76 44 61 74 65 5b 30 5d 20 3d 20 30 3b 0a 0a evDate[0] = 0;..
0b20: 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70 while( db_step
0b30: 28 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 (q)==SQLITE_ROW
0b40: 26 26 20 6e 4c 69 6e 65 3c 3d 6d 78 4c 69 6e 65 && nLine<=mxLine
0b50: 20 29 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 ){. const ch
0b60: 61 72 20 2a 7a 49 64 20 3d 20 64 62 5f 63 6f 6c ar *zId = db_col
0b70: 75 6d 6e 5f 74 65 78 74 28 71 2c 20 30 29 3b 0a umn_text(q, 0);.
0b80: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
0b90: 7a 44 61 74 65 20 3d 20 64 62 5f 63 6f 6c 75 6d zDate = db_colum
0ba0: 6e 5f 74 65 78 74 28 71 2c 20 31 29 3b 0a 20 20 n_text(q, 1);.
0bb0: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 43 const char *zC
0bc0: 6f 6d 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 om = db_column_t
0bd0: 65 78 74 28 71 2c 20 32 29 3b 0a 20 20 20 20 63 ext(q, 2);. c
0be0: 68 61 72 20 7a 55 75 69 64 5b 55 55 49 44 5f 53 har zUuid[UUID_S
0bf0: 49 5a 45 2b 31 5d 3b 0a 0a 20 20 20 20 73 70 72 IZE+1];.. spr
0c00: 69 6e 74 66 28 7a 55 75 69 64 2c 20 22 25 2e 31 intf(zUuid, "%.1
0c10: 30 73 22 2c 20 7a 49 64 29 3b 0a 20 20 20 20 69 0s", zId);. i
0c20: 66 28 20 6d 65 6d 63 6d 70 28 7a 44 61 74 65 2c f( memcmp(zDate,
0c30: 20 7a 50 72 65 76 44 61 74 65 2c 20 31 30 29 20 zPrevDate, 10)
0c40: 29 7b 0a 20 20 20 20 20 20 70 72 69 6e 74 66 28 ){. printf(
0c50: 22 3d 3d 3d 20 25 2e 31 30 73 20 3d 3d 3d 5c 6e "=== %.10s ===\n
0c60: 22 2c 20 7a 44 61 74 65 29 3b 0a 20 20 20 20 20 ", zDate);.
0c70: 20 6d 65 6d 63 70 79 28 7a 50 72 65 76 44 61 74 memcpy(zPrevDat
0c80: 65 2c 20 7a 44 61 74 65 2c 20 31 30 29 3b 0a 20 e, zDate, 10);.
0c90: 20 20 20 20 20 6e 4c 69 6e 65 2b 2b 3b 0a 20 20 nLine++;.
0ca0: 20 20 7d 0a 20 20 20 20 69 66 28 20 7a 43 6f 6d }. if( zCom
0cb0: 3d 3d 30 20 29 20 7a 43 6f 6d 20 3d 20 22 22 3b ==0 ) zCom = "";
0cc0: 0a 20 20 20 20 70 72 69 6e 74 66 28 22 25 2e 35 . printf("%.5
0cd0: 73 20 5b 25 2e 31 30 73 5d 20 22 2c 20 26 7a 44 s [%.10s] ", &zD
0ce0: 61 74 65 5b 31 31 5d 2c 20 7a 55 75 69 64 29 3b ate[11], zUuid);
0cf0: 0a 20 20 20 20 6e 4c 69 6e 65 20 2b 3d 20 63 6f . nLine += co
0d00: 6d 6d 65 6e 74 5f 70 72 69 6e 74 28 7a 43 6f 6d mment_print(zCom
0d10: 2c 20 31 39 2c 20 37 39 29 3b 0a 20 20 7d 0a 7d , 19, 79);. }.}
0d20: 0a 0a 0a 2f 2a 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 .../*.** COMMAND
0d30: 3a 20 74 69 6d 65 6c 69 6e 65 0a 2a 2a 0a 2a 2a : timeline.**.**
0d40: 20 54 68 65 20 74 69 6d 65 6c 69 6e 65 20 63 6f The timeline co
0d50: 6d 6d 61 6e 64 20 77 6f 72 6b 73 20 76 65 72 79 mmand works very
0d60: 20 6d 75 63 68 20 6c 69 6b 65 20 74 68 65 20 74 much like the t
0d70: 69 6d 65 6c 69 6e 65 20 77 65 62 70 61 67 65 2c imeline webpage,
0d80: 20 62 75 74 0a 2a 2a 20 73 68 6f 77 73 20 6d 75 but.** shows mu
0d90: 63 68 20 6c 65 73 73 20 64 61 74 61 20 61 6e 64 ch less data and
0da0: 20 68 61 73 20 66 65 77 65 72 20 63 6f 6e 66 69 has fewer confi
0db0: 67 75 72 61 74 69 6f 6e 20 6f 70 74 69 6f 6e 73 guration options
0dc0: 2e 20 20 49 74 20 69 73 0a 2a 2a 20 69 6e 74 65 . It is.** inte
0dd0: 6e 64 65 64 20 61 73 20 61 20 63 6f 6e 76 65 6e nded as a conven
0de0: 69 65 6e 74 20 73 68 6f 72 74 63 75 74 20 66 6f ient shortcut fo
0df0: 72 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 63 61 73 r the common cas
0e00: 65 20 6f 66 20 73 65 65 69 6e 67 0a 2a 2a 20 72 e of seeing.** r
0e10: 65 63 65 6e 74 20 63 68 61 6e 67 65 73 2e 0a 2a ecent changes..*
0e20: 2f 0a 76 6f 69 64 20 74 69 6d 65 6c 69 6e 65 5f /.void timeline_
0e30: 63 6d 64 28 76 6f 69 64 29 7b 0a 20 20 53 74 6d cmd(void){. Stm
0e40: 74 20 71 3b 0a 20 20 64 62 5f 6d 75 73 74 5f 62 t q;. db_must_b
0e50: 65 5f 77 69 74 68 69 6e 5f 74 72 65 65 28 29 3b e_within_tree();
0e60: 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 71 . db_prepare(&q
0e70: 2c 0a 20 20 20 20 22 53 45 4c 45 43 54 20 75 75 ,. "SELECT uu
0e80: 69 64 2c 20 64 61 74 65 74 69 6d 65 28 65 76 65 id, datetime(eve
0e90: 6e 74 2e 6d 74 69 6d 65 2c 27 6c 6f 63 61 6c 74 nt.mtime,'localt
0ea0: 69 6d 65 27 29 2c 20 63 6f 6d 6d 65 6e 74 22 0a ime'), comment".
0eb0: 20 20 20 20 22 20 20 46 52 4f 4d 20 65 76 65 6e " FROM even
0ec0: 74 2c 20 62 6c 6f 62 22 0a 20 20 20 20 22 20 57 t, blob". " W
0ed0: 48 45 52 45 20 65 76 65 6e 74 2e 74 79 70 65 3d HERE event.type=
0ee0: 27 63 69 27 20 41 4e 44 20 62 6c 6f 62 2e 72 69 'ci' AND blob.ri
0ef0: 64 3d 65 76 65 6e 74 2e 6f 62 6a 69 64 22 0a 20 d=event.objid".
0f00: 20 20 20 22 20 4f 52 44 45 52 20 42 59 20 65 76 " ORDER BY ev
0f10: 65 6e 74 2e 6d 74 69 6d 65 20 44 45 53 43 22 0a ent.mtime DESC".
0f20: 20 20 29 3b 0a 20 20 70 72 69 6e 74 5f 74 69 6d );. print_tim
0f30: 65 6c 69 6e 65 28 26 71 2c 20 32 30 29 3b 0a 20 eline(&q, 20);.
0f40: 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 26 71 29 db_finalize(&q)
0f50: 3b 0a 7d 0a ;.}.