Artifact f18e21591c26b2dc37770a5bb7a5ed73dfe8aae0:
File
src/timeline.c
part of check-in
[5ebcedc33e]
- Require read permission (permission to read tickets and configuration histories) to view the global timeline.
by
dan on
2007-07-31 16:34:09.
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 0a 20 20 2f 2a 20 54 6f 20 76 69 65 77 ];.. /* To view
0630: 20 74 68 65 20 74 69 6d 65 6c 69 6e 65 2c 20 6d the timeline, m
0640: 75 73 74 20 68 61 76 65 20 70 65 72 6d 69 73 73 ust have permiss
0650: 69 6f 6e 20 74 6f 20 72 65 61 64 20 70 72 6f 6a ion to read proj
0660: 65 63 74 20 64 61 74 61 2e 0a 20 20 2a 2f 0a 20 ect data.. */.
0670: 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 login_check_cre
0680: 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 dentials();. if
0690: 28 20 21 67 2e 6f 6b 52 64 54 6b 74 20 29 7b 20 ( !g.okRdTkt ){
06a0: 6c 6f 67 69 6e 5f 6e 65 65 64 65 64 28 29 3b 20 login_needed();
06b0: 72 65 74 75 72 6e 3b 20 7d 0a 0a 20 20 73 74 79 return; }.. sty
06c0: 6c 65 5f 68 65 61 64 65 72 28 22 54 69 6d 65 6c le_header("Timel
06d0: 69 6e 65 22 29 3b 0a 20 20 7a 50 72 65 76 44 61 ine");. zPrevDa
06e0: 74 65 5b 30 5d 20 3d 20 30 3b 0a 20 20 64 62 5f te[0] = 0;. db_
06f0: 70 72 65 70 61 72 65 28 26 71 2c 0a 20 20 20 20 prepare(&q,.
0700: 22 53 45 4c 45 43 54 20 75 75 69 64 2c 20 64 61 "SELECT uuid, da
0710: 74 65 74 69 6d 65 28 65 76 65 6e 74 2e 6d 74 69 tetime(event.mti
0720: 6d 65 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 2c me,'localtime'),
0730: 20 63 6f 6d 6d 65 6e 74 2c 20 75 73 65 72 22 0a comment, user".
0740: 20 20 20 20 22 20 20 46 52 4f 4d 20 65 76 65 6e " FROM even
0750: 74 2c 20 62 6c 6f 62 22 0a 20 20 20 20 22 20 57 t, blob". " W
0760: 48 45 52 45 20 65 76 65 6e 74 2e 74 79 70 65 3d HERE event.type=
0770: 27 63 69 27 20 41 4e 44 20 62 6c 6f 62 2e 72 69 'ci' AND blob.ri
0780: 64 3d 65 76 65 6e 74 2e 6f 62 6a 69 64 22 0a 20 d=event.objid".
0790: 20 20 20 22 20 4f 52 44 45 52 20 42 59 20 65 76 " ORDER BY ev
07a0: 65 6e 74 2e 6d 74 69 6d 65 20 44 45 53 43 22 0a ent.mtime DESC".
07b0: 20 20 29 3b 0a 20 20 40 20 3c 74 61 62 6c 65 20 );. @ <table
07c0: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 30 20 62 6f cellspacing=0 bo
07d0: 72 64 65 72 3d 30 20 63 65 6c 6c 70 61 64 64 69 rder=0 cellpaddi
07e0: 6e 67 3d 30 3e 0a 20 20 77 68 69 6c 65 28 20 64 ng=0>. while( d
07f0: 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 51 4c 49 b_step(&q)==SQLI
0800: 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 63 6f TE_ROW ){. co
0810: 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 65 20 nst char *zDate
0820: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 = db_column_text
0830: 28 26 71 2c 20 31 29 3b 0a 20 20 20 20 69 66 28 (&q, 1);. if(
0840: 20 6d 65 6d 63 6d 70 28 7a 44 61 74 65 2c 20 7a memcmp(zDate, z
0850: 50 72 65 76 44 61 74 65 2c 20 31 30 29 20 29 7b PrevDate, 10) ){
0860: 0a 20 20 20 20 20 20 73 70 72 69 6e 74 66 28 7a . sprintf(z
0870: 50 72 65 76 44 61 74 65 2c 20 22 25 2e 31 30 73 PrevDate, "%.10s
0880: 22 2c 20 7a 44 61 74 65 29 3b 0a 20 20 20 20 20 ", zDate);.
0890: 20 40 20 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 70 @ <tr><td colsp
08a0: 61 6e 3d 33 3e 0a 20 20 20 20 20 20 40 20 3c 74 an=3>. @ <t
08b0: 61 62 6c 65 20 63 65 6c 6c 70 61 64 64 69 6e 67 able cellpadding
08c0: 3d 32 20 62 6f 72 64 65 72 3d 30 3e 0a 20 20 20 =2 border=0>.
08d0: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 62 67 63 @ <tr><td bgc
08e0: 6f 6c 6f 72 3d 22 23 61 30 62 35 66 34 22 20 63 olor="#a0b5f4" c
08f0: 6c 61 73 73 3d 22 62 6f 72 64 65 72 31 22 3e 0a lass="border1">.
0900: 20 20 20 20 20 20 40 20 3c 74 61 62 6c 65 20 63 @ <table c
0910: 65 6c 6c 70 61 64 64 69 6e 67 3d 32 20 63 65 6c ellpadding=2 cel
0920: 6c 73 70 61 63 69 6e 67 3d 30 20 62 6f 72 64 65 lspacing=0 borde
0930: 72 3d 30 3e 3c 74 72 3e 0a 20 20 20 20 20 20 40 r=0><tr>. @
0940: 20 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 64 <td bgcolor="#d
0950: 30 64 39 66 34 22 20 63 6c 61 73 73 3d 22 62 6b 0d9f4" class="bk
0960: 67 6e 64 31 22 3e 25 73 28 7a 50 72 65 76 44 61 gnd1">%s(zPrevDa
0970: 74 65 29 3c 2f 74 64 3e 0a 20 20 20 20 20 20 40 te)</td>. @
0980: 20 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a 20 </tr></table>.
0990: 20 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 @ </td></tr
09a0: 3e 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 20 20 ></table>.
09b0: 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 @ </td></tr>.
09c0: 20 7d 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 }. @ <tr><td
09d0: 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22 3e 25 73 valign="top">%s
09e0: 28 26 7a 44 61 74 65 5b 31 31 5d 29 3c 2f 74 64 (&zDate[11])</td
09f0: 3e 0a 20 20 20 20 40 20 3c 74 64 20 77 69 64 74 >. @ <td widt
0a00: 68 3d 22 32 30 22 3e 3c 2f 74 64 3e 0a 20 20 20 h="20"></td>.
0a10: 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74 @ <td valign="t
0a20: 6f 70 22 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 op" align="left"
0a30: 3e 0a 20 20 20 20 68 79 70 65 72 6c 69 6e 6b 5f >. hyperlink_
0a40: 74 6f 5f 75 75 69 64 28 64 62 5f 63 6f 6c 75 6d to_uuid(db_colum
0a50: 6e 5f 74 65 78 74 28 26 71 2c 30 29 29 3b 0a 20 n_text(&q,0));.
0a60: 20 20 20 40 20 25 68 28 64 62 5f 63 6f 6c 75 6d @ %h(db_colum
0a70: 6e 5f 74 65 78 74 28 26 71 2c 32 29 29 20 28 62 n_text(&q,2)) (b
0a80: 79 20 25 68 28 64 62 5f 63 6f 6c 75 6d 6e 5f 74 y %h(db_column_t
0a90: 65 78 74 28 26 71 2c 33 29 29 29 3c 2f 74 64 3e ext(&q,3)))</td>
0aa0: 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 . }. db_finali
0ab0: 7a 65 28 26 71 29 3b 0a 20 20 40 20 3c 2f 74 61 ze(&q);. @ </ta
0ac0: 62 6c 65 3e 0a 20 20 73 74 79 6c 65 5f 66 6f 6f ble>. style_foo
0ad0: 74 65 72 28 29 3b 0a 7d 0a 2f 2a 0a 2a 2a 20 54 ter();.}./*.** T
0ae0: 68 65 20 69 6e 70 75 74 20 71 75 65 72 79 20 71 he input query q
0af0: 20 73 65 6c 65 63 74 73 20 76 61 72 69 6f 75 73 selects various
0b00: 20 72 65 63 6f 72 64 73 2e 20 20 50 72 69 6e 74 records. Print
0b10: 20 61 20 68 75 6d 61 6e 2d 72 65 61 64 61 62 6c a human-readabl
0b20: 65 0a 2a 2a 20 73 75 6d 6d 61 72 79 20 6f 66 20 e.** summary of
0b30: 74 68 6f 73 65 20 72 65 63 6f 72 64 73 2e 0a 2a those records..*
0b40: 2a 0a 2a 2a 20 4c 69 6d 69 74 20 74 68 65 20 6e *.** Limit the n
0b50: 75 6d 62 65 72 20 6f 66 20 65 6e 74 72 69 65 73 umber of entries
0b60: 20 70 72 69 6e 74 65 64 20 74 6f 20 6e 4c 69 6e printed to nLin
0b70: 65 2e 0a 2a 2f 0a 76 6f 69 64 20 70 72 69 6e 74 e..*/.void print
0b80: 5f 74 69 6d 65 6c 69 6e 65 28 53 74 6d 74 20 2a _timeline(Stmt *
0b90: 71 2c 20 69 6e 74 20 6d 78 4c 69 6e 65 29 7b 0a q, int mxLine){.
0ba0: 20 20 69 6e 74 20 6e 4c 69 6e 65 20 3d 20 30 3b int nLine = 0;
0bb0: 0a 20 20 63 68 61 72 20 7a 50 72 65 76 44 61 74 . char zPrevDat
0bc0: 65 5b 32 30 5d 3b 0a 20 20 7a 50 72 65 76 44 61 e[20];. zPrevDa
0bd0: 74 65 5b 30 5d 20 3d 20 30 3b 0a 0a 20 20 77 68 te[0] = 0;.. wh
0be0: 69 6c 65 28 20 64 62 5f 73 74 65 70 28 71 29 3d ile( db_step(q)=
0bf0: 3d 53 51 4c 49 54 45 5f 52 4f 57 20 26 26 20 6e =SQLITE_ROW && n
0c00: 4c 69 6e 65 3c 3d 6d 78 4c 69 6e 65 20 29 7b 0a Line<=mxLine ){.
0c10: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
0c20: 7a 49 64 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f zId = db_column_
0c30: 74 65 78 74 28 71 2c 20 30 29 3b 0a 20 20 20 20 text(q, 0);.
0c40: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 const char *zDat
0c50: 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 e = db_column_te
0c60: 78 74 28 71 2c 20 31 29 3b 0a 20 20 20 20 63 6f xt(q, 1);. co
0c70: 6e 73 74 20 63 68 61 72 20 2a 7a 43 6f 6d 20 3d nst char *zCom =
0c80: 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 db_column_text(
0c90: 71 2c 20 32 29 3b 0a 20 20 20 20 63 68 61 72 20 q, 2);. char
0ca0: 7a 55 75 69 64 5b 55 55 49 44 5f 53 49 5a 45 2b zUuid[UUID_SIZE+
0cb0: 31 5d 3b 0a 0a 20 20 20 20 73 70 72 69 6e 74 66 1];.. sprintf
0cc0: 28 7a 55 75 69 64 2c 20 22 25 2e 31 30 73 22 2c (zUuid, "%.10s",
0cd0: 20 7a 49 64 29 3b 0a 20 20 20 20 69 66 28 20 6d zId);. if( m
0ce0: 65 6d 63 6d 70 28 7a 44 61 74 65 2c 20 7a 50 72 emcmp(zDate, zPr
0cf0: 65 76 44 61 74 65 2c 20 31 30 29 20 29 7b 0a 20 evDate, 10) ){.
0d00: 20 20 20 20 20 70 72 69 6e 74 66 28 22 3d 3d 3d printf("===
0d10: 20 25 2e 31 30 73 20 3d 3d 3d 5c 6e 22 2c 20 7a %.10s ===\n", z
0d20: 44 61 74 65 29 3b 0a 20 20 20 20 20 20 6d 65 6d Date);. mem
0d30: 63 70 79 28 7a 50 72 65 76 44 61 74 65 2c 20 7a cpy(zPrevDate, z
0d40: 44 61 74 65 2c 20 31 30 29 3b 0a 20 20 20 20 20 Date, 10);.
0d50: 20 6e 4c 69 6e 65 2b 2b 3b 0a 20 20 20 20 7d 0a nLine++;. }.
0d60: 20 20 20 20 69 66 28 20 7a 43 6f 6d 3d 3d 30 20 if( zCom==0
0d70: 29 20 7a 43 6f 6d 20 3d 20 22 22 3b 0a 20 20 20 ) zCom = "";.
0d80: 20 70 72 69 6e 74 66 28 22 25 2e 35 73 20 5b 25 printf("%.5s [%
0d90: 2e 31 30 73 5d 20 22 2c 20 26 7a 44 61 74 65 5b .10s] ", &zDate[
0da0: 31 31 5d 2c 20 7a 55 75 69 64 29 3b 0a 20 20 20 11], zUuid);.
0db0: 20 6e 4c 69 6e 65 20 2b 3d 20 63 6f 6d 6d 65 6e nLine += commen
0dc0: 74 5f 70 72 69 6e 74 28 7a 43 6f 6d 2c 20 31 39 t_print(zCom, 19
0dd0: 2c 20 37 39 29 3b 0a 20 20 7d 0a 7d 0a 0a 0a 2f , 79);. }.}.../
0de0: 2a 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 74 69 *.** COMMAND: ti
0df0: 6d 65 6c 69 6e 65 0a 2a 2a 0a 2a 2a 20 54 68 65 meline.**.** The
0e00: 20 74 69 6d 65 6c 69 6e 65 20 63 6f 6d 6d 61 6e timeline comman
0e10: 64 20 77 6f 72 6b 73 20 76 65 72 79 20 6d 75 63 d works very muc
0e20: 68 20 6c 69 6b 65 20 74 68 65 20 74 69 6d 65 6c h like the timel
0e30: 69 6e 65 20 77 65 62 70 61 67 65 2c 20 62 75 74 ine webpage, but
0e40: 0a 2a 2a 20 73 68 6f 77 73 20 6d 75 63 68 20 6c .** shows much l
0e50: 65 73 73 20 64 61 74 61 20 61 6e 64 20 68 61 73 ess data and has
0e60: 20 66 65 77 65 72 20 63 6f 6e 66 69 67 75 72 61 fewer configura
0e70: 74 69 6f 6e 20 6f 70 74 69 6f 6e 73 2e 20 20 49 tion options. I
0e80: 74 20 69 73 0a 2a 2a 20 69 6e 74 65 6e 64 65 64 t is.** intended
0e90: 20 61 73 20 61 20 63 6f 6e 76 65 6e 69 65 6e 74 as a convenient
0ea0: 20 73 68 6f 72 74 63 75 74 20 66 6f 72 20 74 68 shortcut for th
0eb0: 65 20 63 6f 6d 6d 6f 6e 20 63 61 73 65 20 6f 66 e common case of
0ec0: 20 73 65 65 69 6e 67 0a 2a 2a 20 72 65 63 65 6e seeing.** recen
0ed0: 74 20 63 68 61 6e 67 65 73 2e 0a 2a 2f 0a 76 6f t changes..*/.vo
0ee0: 69 64 20 74 69 6d 65 6c 69 6e 65 5f 63 6d 64 28 id timeline_cmd(
0ef0: 76 6f 69 64 29 7b 0a 20 20 53 74 6d 74 20 71 3b void){. Stmt q;
0f00: 0a 20 20 64 62 5f 6d 75 73 74 5f 62 65 5f 77 69 . db_must_be_wi
0f10: 74 68 69 6e 5f 74 72 65 65 28 29 3b 0a 20 20 64 thin_tree();. d
0f20: 62 5f 70 72 65 70 61 72 65 28 26 71 2c 0a 20 20 b_prepare(&q,.
0f30: 20 20 22 53 45 4c 45 43 54 20 75 75 69 64 2c 20 "SELECT uuid,
0f40: 64 61 74 65 74 69 6d 65 28 65 76 65 6e 74 2e 6d datetime(event.m
0f50: 74 69 6d 65 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 time,'localtime'
0f60: 29 2c 22 0a 20 20 20 20 22 20 20 20 20 20 20 20 ),". "
0f70: 63 6f 6d 6d 65 6e 74 20 7c 7c 20 27 20 28 62 79 comment || ' (by
0f80: 20 27 20 7c 7c 20 75 73 65 72 20 7c 7c 20 27 29 ' || user || ')
0f90: 27 22 0a 20 20 20 20 22 20 20 46 52 4f 4d 20 65 '". " FROM e
0fa0: 76 65 6e 74 2c 20 62 6c 6f 62 22 0a 20 20 20 20 vent, blob".
0fb0: 22 20 57 48 45 52 45 20 65 76 65 6e 74 2e 74 79 " WHERE event.ty
0fc0: 70 65 3d 27 63 69 27 20 41 4e 44 20 62 6c 6f 62 pe='ci' AND blob
0fd0: 2e 72 69 64 3d 65 76 65 6e 74 2e 6f 62 6a 69 64 .rid=event.objid
0fe0: 22 0a 20 20 20 20 22 20 4f 52 44 45 52 20 42 59 ". " ORDER BY
0ff0: 20 65 76 65 6e 74 2e 6d 74 69 6d 65 20 44 45 53 event.mtime DES
1000: 43 22 0a 20 20 29 3b 0a 20 20 70 72 69 6e 74 5f C". );. print_
1010: 74 69 6d 65 6c 69 6e 65 28 26 71 2c 20 32 30 29 timeline(&q, 20)
1020: 3b 0a 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 ;. db_finalize(
1030: 26 71 29 3b 0a 7d 0a &q);.}.