Artifact 5b214b819fed20727cc1ef1a37b26468efa5ad56:
File
src/timeline.c
part of check-in
[dbda8d6ce9]
- Initial check-in of m1 sources.
by
drh on
2007-07-21 14:10:57.
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 29 3b 0a 20 20 7a 50 72 65 76 44 61 74 65 r();. zPrevDate
0640: 5b 30 5d 20 3d 20 30 3b 0a 20 20 64 62 5f 70 72 [0] = 0;. db_pr
0650: 65 70 61 72 65 28 26 71 2c 0a 20 20 20 20 22 53 epare(&q,. "S
0660: 45 4c 45 43 54 20 72 69 64 2c 20 74 79 70 65 2c ELECT rid, type,
0670: 20 75 75 69 64 2c 20 64 61 74 65 74 69 6d 65 28 uuid, datetime(
0680: 63 74 69 6d 65 2c 27 75 6e 69 78 65 70 6f 63 68 ctime,'unixepoch
0690: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 2c 20 ','localtime'),
06a0: 63 6f 6d 6d 65 6e 74 22 0a 20 20 20 20 22 20 20 comment". "
06b0: 46 52 4f 4d 20 72 65 63 6f 72 64 22 0a 20 20 20 FROM record".
06c0: 20 22 20 57 48 45 52 45 20 4e 4f 54 20 70 68 61 " WHERE NOT pha
06d0: 6e 74 6f 6d 20 41 4e 44 20 4e 4f 54 20 63 61 6e ntom AND NOT can
06e0: 63 65 6c 22 0a 20 20 20 20 22 20 20 20 41 4e 44 cel". " AND
06f0: 20 74 79 70 65 20 49 4e 20 28 27 76 27 29 22 0a type IN ('v')".
0700: 20 20 20 20 22 20 4f 52 44 45 52 20 42 59 20 63 " ORDER BY c
0710: 74 69 6d 65 20 44 45 53 43 22 0a 20 20 20 20 22 time DESC". "
0720: 20 4c 49 4d 49 54 20 31 30 30 22 0a 20 20 29 3b LIMIT 100". );
0730: 0a 20 20 40 20 3c 74 61 62 6c 65 20 63 65 6c 6c . @ <table cell
0740: 73 70 61 63 69 6e 67 3d 30 20 62 6f 72 64 65 72 spacing=0 border
0750: 3d 30 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 30 =0 cellpadding=0
0760: 3e 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 >. while( db_st
0770: 65 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 ep(&q)==SQLITE_R
0780: 4f 57 20 29 7b 0a 20 20 20 20 63 6f 6e 73 74 20 OW ){. const
0790: 63 68 61 72 20 2a 7a 44 61 74 65 20 3d 20 64 62 char *zDate = db
07a0: 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c _column_text(&q,
07b0: 20 33 29 3b 0a 20 20 20 20 69 66 28 20 6d 65 6d 3);. if( mem
07c0: 63 6d 70 28 7a 44 61 74 65 2c 20 7a 50 72 65 76 cmp(zDate, zPrev
07d0: 44 61 74 65 2c 20 31 30 29 20 29 7b 0a 20 20 20 Date, 10) ){.
07e0: 20 20 20 73 70 72 69 6e 74 66 28 7a 50 72 65 76 sprintf(zPrev
07f0: 44 61 74 65 2c 20 22 25 2e 31 30 73 22 2c 20 7a Date, "%.10s", z
0800: 44 61 74 65 29 3b 0a 20 20 20 20 20 20 40 20 3c Date);. @ <
0810: 74 72 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 33 tr><td colspan=3
0820: 3e 0a 20 20 20 20 20 20 40 20 3c 74 61 62 6c 65 >. @ <table
0830: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 32 20 62 cellpadding=2 b
0840: 6f 72 64 65 72 3d 30 3e 0a 20 20 20 20 20 20 40 order=0>. @
0850: 20 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 <tr><td bgcolor
0860: 3d 22 23 61 30 62 35 66 34 22 20 63 6c 61 73 73 ="#a0b5f4" class
0870: 3d 22 62 6f 72 64 65 72 31 22 3e 0a 20 20 20 20 ="border1">.
0880: 20 20 40 20 3c 74 61 62 6c 65 20 63 65 6c 6c 70 @ <table cellp
0890: 61 64 64 69 6e 67 3d 32 20 63 65 6c 6c 73 70 61 adding=2 cellspa
08a0: 63 69 6e 67 3d 30 20 62 6f 72 64 65 72 3d 30 3e cing=0 border=0>
08b0: 3c 74 72 3e 0a 20 20 20 20 20 20 40 20 3c 74 64 <tr>. @ <td
08c0: 20 62 67 63 6f 6c 6f 72 3d 22 23 64 30 64 39 66 bgcolor="#d0d9f
08d0: 34 22 20 63 6c 61 73 73 3d 22 62 6b 67 6e 64 31 4" class="bkgnd1
08e0: 22 3e 25 73 28 7a 50 72 65 76 44 61 74 65 29 3c ">%s(zPrevDate)<
08f0: 2f 74 64 3e 0a 20 20 20 20 20 20 40 20 3c 2f 74 /td>. @ </t
0900: 72 3e 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 20 r></table>.
0910: 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 @ </td></tr></t
0920: 61 62 6c 65 3e 0a 20 20 20 20 20 20 40 20 3c 2f able>. @ </
0930: 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 7d 0a 20 td></tr>. }.
0940: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 76 61 6c @ <tr><td val
0950: 69 67 6e 3d 22 74 6f 70 22 3e 25 73 28 26 7a 44 ign="top">%s(&zD
0960: 61 74 65 5b 31 31 5d 29 3c 2f 74 64 3e 0a 20 20 ate[11])</td>.
0970: 20 20 40 20 3c 74 64 20 77 69 64 74 68 3d 22 32 @ <td width="2
0980: 30 22 3e 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c 0"></td>. @ <
0990: 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22 20 td valign="top"
09a0: 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e 0a 20 20 align="left">.
09b0: 20 20 68 79 70 65 72 6c 69 6e 6b 5f 74 6f 5f 75 hyperlink_to_u
09c0: 75 69 64 28 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 uid(db_column_te
09d0: 78 74 28 26 71 2c 32 29 29 3b 0a 20 20 20 20 40 xt(&q,2));. @
09e0: 20 25 73 28 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 %s(db_column_te
09f0: 78 74 28 26 71 2c 34 29 29 3c 2f 74 64 3e 0a 20 xt(&q,4))</td>.
0a00: 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 }. db_finalize
0a10: 28 26 71 29 3b 0a 20 20 40 20 3c 2f 74 61 62 6c (&q);. @ </tabl
0a20: 65 3e 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 e>. style_foote
0a30: 72 28 29 3b 0a 7d 0a 2f 2a 0a 2a 2a 20 54 68 65 r();.}./*.** The
0a40: 20 69 6e 70 75 74 20 71 75 65 72 79 20 71 20 73 input query q s
0a50: 65 6c 65 63 74 73 20 76 61 72 69 6f 75 73 20 72 elects various r
0a60: 65 63 6f 72 64 73 2e 20 20 50 72 69 6e 74 20 61 ecords. Print a
0a70: 20 68 75 6d 61 6e 2d 72 65 61 64 61 62 6c 65 0a human-readable.
0a80: 2a 2a 20 73 75 6d 6d 61 72 79 20 6f 66 20 74 68 ** summary of th
0a90: 6f 73 65 20 72 65 63 6f 72 64 73 2e 0a 2a 2a 0a ose records..**.
0aa0: 2a 2a 20 4c 69 6d 69 74 20 74 68 65 20 6e 75 6d ** Limit the num
0ab0: 62 65 72 20 6f 66 20 65 6e 74 72 69 65 73 20 70 ber of entries p
0ac0: 72 69 6e 74 65 64 20 74 6f 20 6e 4c 69 6e 65 2e rinted to nLine.
0ad0: 0a 2a 2f 0a 76 6f 69 64 20 70 72 69 6e 74 5f 74 .*/.void print_t
0ae0: 69 6d 65 6c 69 6e 65 28 53 74 6d 74 20 2a 71 2c imeline(Stmt *q,
0af0: 20 69 6e 74 20 6d 78 4c 69 6e 65 29 7b 0a 20 20 int mxLine){.
0b00: 69 6e 74 20 6e 4c 69 6e 65 20 3d 20 30 3b 0a 20 int nLine = 0;.
0b10: 20 63 68 61 72 20 7a 50 72 65 76 44 61 74 65 5b char zPrevDate[
0b20: 32 30 5d 3b 0a 20 20 7a 50 72 65 76 44 61 74 65 20];. zPrevDate
0b30: 5b 30 5d 20 3d 20 30 3b 0a 0a 20 20 77 68 69 6c [0] = 0;.. whil
0b40: 65 28 20 64 62 5f 73 74 65 70 28 71 29 3d 3d 53 e( db_step(q)==S
0b50: 51 4c 49 54 45 5f 52 4f 57 20 26 26 20 6e 4c 69 QLITE_ROW && nLi
0b60: 6e 65 3c 3d 6d 78 4c 69 6e 65 20 29 7b 0a 20 20 ne<=mxLine ){.
0b70: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 49 const char *zI
0b80: 64 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 d = db_column_te
0b90: 78 74 28 71 2c 20 30 29 3b 0a 20 20 20 20 63 6f xt(q, 0);. co
0ba0: 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 65 20 nst char *zDate
0bb0: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 = db_column_text
0bc0: 28 71 2c 20 31 29 3b 0a 20 20 20 20 63 6f 6e 73 (q, 1);. cons
0bd0: 74 20 63 68 61 72 20 2a 7a 43 6f 6d 20 3d 20 64 t char *zCom = d
0be0: 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 71 2c b_column_text(q,
0bf0: 20 32 29 3b 0a 20 20 20 20 63 68 61 72 20 7a 55 2);. char zU
0c00: 75 69 64 5b 55 55 49 44 5f 53 49 5a 45 2b 31 5d uid[UUID_SIZE+1]
0c10: 3b 0a 0a 20 20 20 20 73 70 72 69 6e 74 66 28 7a ;.. sprintf(z
0c20: 55 75 69 64 2c 20 22 25 2e 31 30 73 22 2c 20 7a Uuid, "%.10s", z
0c30: 49 64 29 3b 0a 20 20 20 20 69 66 28 20 6d 65 6d Id);. if( mem
0c40: 63 6d 70 28 7a 44 61 74 65 2c 20 7a 50 72 65 76 cmp(zDate, zPrev
0c50: 44 61 74 65 2c 20 31 30 29 20 29 7b 0a 20 20 20 Date, 10) ){.
0c60: 20 20 20 70 72 69 6e 74 66 28 22 3d 3d 3d 20 25 printf("=== %
0c70: 2e 31 30 73 20 3d 3d 3d 5c 6e 22 2c 20 7a 44 61 .10s ===\n", zDa
0c80: 74 65 29 3b 0a 20 20 20 20 20 20 6d 65 6d 63 70 te);. memcp
0c90: 79 28 7a 50 72 65 76 44 61 74 65 2c 20 7a 44 61 y(zPrevDate, zDa
0ca0: 74 65 2c 20 31 30 29 3b 0a 20 20 20 20 20 20 6e te, 10);. n
0cb0: 4c 69 6e 65 2b 2b 3b 0a 20 20 20 20 7d 0a 20 20 Line++;. }.
0cc0: 20 20 69 66 28 20 7a 43 6f 6d 3d 3d 30 20 29 20 if( zCom==0 )
0cd0: 7a 43 6f 6d 20 3d 20 22 22 3b 0a 20 20 20 20 70 zCom = "";. p
0ce0: 72 69 6e 74 66 28 22 25 2e 35 73 20 5b 25 2e 31 rintf("%.5s [%.1
0cf0: 30 73 5d 20 22 2c 20 26 7a 44 61 74 65 5b 31 31 0s] ", &zDate[11
0d00: 5d 2c 20 7a 55 75 69 64 29 3b 0a 20 20 20 20 6e ], zUuid);. n
0d10: 4c 69 6e 65 20 2b 3d 20 63 6f 6d 6d 65 6e 74 5f Line += comment_
0d20: 70 72 69 6e 74 28 7a 43 6f 6d 2c 20 31 39 2c 20 print(zCom, 19,
0d30: 37 39 29 3b 0a 20 20 7d 0a 7d 0a 0a 0a 2f 2a 0a 79);. }.}.../*.
0d40: 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 74 69 6d 65 ** COMMAND: time
0d50: 6c 69 6e 65 0a 2a 2a 0a 2a 2a 20 54 68 65 20 74 line.**.** The t
0d60: 69 6d 65 6c 69 6e 65 20 63 6f 6d 6d 61 6e 64 20 imeline command
0d70: 77 6f 72 6b 73 20 76 65 72 79 20 6d 75 63 68 20 works very much
0d80: 6c 69 6b 65 20 74 68 65 20 74 69 6d 65 6c 69 6e like the timelin
0d90: 65 20 77 65 62 70 61 67 65 2c 20 62 75 74 0a 2a e webpage, but.*
0da0: 2a 20 73 68 6f 77 73 20 6d 75 63 68 20 6c 65 73 * shows much les
0db0: 73 20 64 61 74 61 20 61 6e 64 20 68 61 73 20 66 s data and has f
0dc0: 65 77 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 ewer configurati
0dd0: 6f 6e 20 6f 70 74 69 6f 6e 73 2e 20 20 49 74 20 on options. It
0de0: 69 73 0a 2a 2a 20 69 6e 74 65 6e 64 65 64 20 61 is.** intended a
0df0: 73 20 61 20 63 6f 6e 76 65 6e 69 65 6e 74 20 73 s a convenient s
0e00: 68 6f 72 74 63 75 74 20 66 6f 72 20 74 68 65 20 hortcut for the
0e10: 63 6f 6d 6d 6f 6e 20 63 61 73 65 20 6f 66 20 73 common case of s
0e20: 65 65 69 6e 67 0a 2a 2a 20 72 65 63 65 6e 74 20 eeing.** recent
0e30: 63 68 61 6e 67 65 73 2e 0a 2a 2f 0a 76 6f 69 64 changes..*/.void
0e40: 20 74 69 6d 65 6c 69 6e 65 5f 63 6d 64 28 76 6f timeline_cmd(vo
0e50: 69 64 29 7b 0a 20 20 53 74 6d 74 20 71 3b 0a 20 id){. Stmt q;.
0e60: 20 64 62 5f 6d 75 73 74 5f 62 65 5f 77 69 74 68 db_must_be_with
0e70: 69 6e 5f 74 72 65 65 28 29 3b 0a 20 20 64 62 5f in_tree();. db_
0e80: 70 72 65 70 61 72 65 28 26 71 2c 0a 20 20 20 20 prepare(&q,.
0e90: 22 53 45 4c 45 43 54 20 75 75 69 64 2c 20 64 61 "SELECT uuid, da
0ea0: 74 65 74 69 6d 65 28 65 76 65 6e 74 2e 6d 74 69 tetime(event.mti
0eb0: 6d 65 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 2c me,'localtime'),
0ec0: 20 63 6f 6d 6d 65 6e 74 22 0a 20 20 20 20 22 20 comment". "
0ed0: 20 46 52 4f 4d 20 65 76 65 6e 74 2c 20 62 6c 6f FROM event, blo
0ee0: 62 22 0a 20 20 20 20 22 20 57 48 45 52 45 20 65 b". " WHERE e
0ef0: 76 65 6e 74 2e 74 79 70 65 3d 27 63 69 27 20 41 vent.type='ci' A
0f00: 4e 44 20 62 6c 6f 62 2e 72 69 64 3d 65 76 65 6e ND blob.rid=even
0f10: 74 2e 6f 62 6a 69 64 22 0a 20 20 20 20 22 20 4f t.objid". " O
0f20: 52 44 45 52 20 42 59 20 65 76 65 6e 74 2e 6d 74 RDER BY event.mt
0f30: 69 6d 65 20 44 45 53 43 22 0a 20 20 29 3b 0a 20 ime DESC". );.
0f40: 20 70 72 69 6e 74 5f 74 69 6d 65 6c 69 6e 65 28 print_timeline(
0f50: 26 71 2c 20 32 30 29 3b 0a 20 20 64 62 5f 66 69 &q, 20);. db_fi
0f60: 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 7d 0a nalize(&q);.}.