Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 611b3b206bdfea6d2c71f4ff13a369918d5181ec |
|---|---|
| Date: | 2010-03-15 16:16:34 |
| User: | drh |
| Comment: | Show check-ins that mention a ticket in the ticket timeline. |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
Changes to src/tkt.c
| Old (cb76bfccd0c1a8af) | New (26c5d6f1c68ffa4c) | |||
|---|---|---|---|---|
| 1 | /* | 1 | /* | |
| 2 | ** Copyright (c) 2007 D. Richard Hipp | 2 | ** Copyright (c) 2007 D. Richard Hipp | |
| 3 | ** | 3 | ** | |
| 4 | ** This program is free software; you can redistribute it and/or | 4 | ** This program is free software; you can redistribute it and/or | |
| 5 | ** modify it under the terms of the GNU General Public | 5 | ** modify it under the terms of the GNU General Public | |
| 160 hidden lines | ||||
| 166 | Th_Store(z, P(z)); | 166 | Th_Store(z, P(z)); | |
| 167 | } | 167 | } | |
| 168 | } | 168 | } | |
| 169 | 169 | |||
| 170 | /* | 170 | /* | |
| 171 | ** Rebuild all tickets named in the _pending_ticket table. | < | ||
| 172 | ** | < | ||
| 173 | ** This routine is called just prior to commit after new | < | ||
| 174 | ** out-of-sequence ticket changes have been added. | < | ||
| 175 | */ | < | ||
| 176 | static int ticket_rebuild_at_commit(void){ | < | ||
| 177 | Stmt q; | < | ||
| 178 | db_multi_exec( | < | ||
| 179 | "DELETE FROM ticket WHERE tkt_uuid IN _pending_ticket" | < | ||
| 180 | ); | < | ||
| 181 | db_prepare(&q, "SELECT uuid FROM _pending_ticket"); | < | ||
| 182 | while( db_step(&q)==SQLITE_ROW ){ | < | ||
| 183 | const char *zUuid = db_column_text(&q, 0); | < | ||
| 184 | ticket_rebuild_entry(zUuid); | < | ||
| 185 | } | < | ||
| 186 | db_multi_exec( | < | ||
| 187 | "DELETE FROM _pending_ticket" | < | ||
| 188 | ); | < | ||
| 189 | return 0; | < | ||
| 190 | } | < | ||
| 191 | < | |||
| 192 | /* | < | ||
| 193 | ** Update an entry of the TICKET table according to the information | 171 | ** Update an entry of the TICKET table according to the information | |
| 194 | ** in the control file given in p. Attempt to create the appropriate | 172 | ** in the control file given in p. Attempt to create the appropriate | |
| 195 | ** TICKET table entry if createFlag is true. If createFlag is false, | 173 | ** TICKET table entry if createFlag is true. If createFlag is false, | |
| 196 | ** that means we already know the entry exists and so we can save the | 174 | ** that means we already know the entry exists and so we can save the | |
| 197 | ** work of trying to create it. | 175 | ** work of trying to create it. | |
| 198 | ** | 176 | ** | |
| 199 | ** Return TRUE if a new TICKET entry was created and FALSE if an | 177 | ** Return TRUE if a new TICKET entry was created and FALSE if an | |
| 200 | ** existing entry was revised. | 178 | ** existing entry was revised. | |
| 201 | */ | 179 | */ | |
| 202 | int ticket_insert(const Manifest *p, int createFlag, int checkTime){ | | | 180 | int ticket_insert(const Manifest *p, int createFlag, int rid){ |
| 203 | Blob sql; | 181 | Blob sql; | |
| 204 | Stmt q; | 182 | Stmt q; | |
| 205 | int i; | 183 | int i; | |
| 206 | const char *zSep; | 184 | const char *zSep; | |
| 207 | int rc = 0; | 185 | int rc = 0; | |
| 16 hidden lines | ||||
| 224 | zName, zName, p->aField[i].zValue); | 202 | zName, zName, p->aField[i].zValue); | |
| 225 | }else{ | 203 | }else{ | |
| 226 | if( fieldId(zName)<0 ) continue; | 204 | if( fieldId(zName)<0 ) continue; | |
| 227 | blob_appendf(&sql,", %s=%Q", zName, p->aField[i].zValue); | 205 | blob_appendf(&sql,", %s=%Q", zName, p->aField[i].zValue); | |
| 228 | } | 206 | } | |
| > | 207 | if( rid>0 ){ | ||
| > | 208 | wiki_extract_links(p->aField[i].zValue, rid, 1, p->rDate, i==0, 0); | ||
| > | 209 | } | ||
| 229 | } | 210 | } | |
| 230 | blob_appendf(&sql, " WHERE tkt_uuid='%s' AND tkt_mtime<:mtime", | 211 | blob_appendf(&sql, " WHERE tkt_uuid='%s' AND tkt_mtime<:mtime", | |
| 231 | p->zTicketUuid); | 212 | p->zTicketUuid); | |
| 232 | db_prepare(&q, "%s", blob_str(&sql)); | 213 | db_prepare(&q, "%s", blob_str(&sql)); | |
| 233 | db_bind_double(&q, ":mtime", p->rDate); | 214 | db_bind_double(&q, ":mtime", p->rDate); | |
| 234 | db_step(&q); | 215 | db_step(&q); | |
| 235 | db_finalize(&q); | 216 | db_finalize(&q); | |
| 236 | if( checkTime && db_changes()==0 ){ | < | ||
| 237 | static int isInit = 0; | < | ||
| 238 | if( !isInit ){ | < | ||
| 239 | db_multi_exec("CREATE TEMP TABLE _pending_ticket(uuid TEXT UNIQUE)"); | < | ||
| 240 | db_commit_hook(ticket_rebuild_at_commit, 1); | < | ||
| 241 | isInit = 1; | < | ||
| 242 | } | < | ||
| 243 | db_multi_exec("INSERT OR IGNORE INTO _pending_ticket " | < | ||
| 244 | "VALUES(%Q)", p->zTicketUuid); | < | ||
| 245 | } | < | ||
| 246 | blob_reset(&sql); | 217 | blob_reset(&sql); | |
| 247 | return rc; | 218 | return rc; | |
| 248 | } | 219 | } | |
| 249 | 220 | |||
| 250 | /* | 221 | /* | |
| 13 hidden lines | ||||
| 264 | db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid); | 235 | db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid); | |
| 265 | while( db_step(&q)==SQLITE_ROW ){ | 236 | while( db_step(&q)==SQLITE_ROW ){ | |
| 266 | int rid = db_column_int(&q, 0); | 237 | int rid = db_column_int(&q, 0); | |
| 267 | content_get(rid, &content); | 238 | content_get(rid, &content); | |
| 268 | manifest_parse(&manifest, &content); | 239 | manifest_parse(&manifest, &content); | |
| 269 | ticket_insert(&manifest, createFlag, 0); | | | 240 | ticket_insert(&manifest, createFlag, rid); |
| 270 | manifest_ticket_event(rid, &manifest, createFlag, tagid); | 241 | manifest_ticket_event(rid, &manifest, createFlag, tagid); | |
| 271 | manifest_clear(&manifest); | 242 | manifest_clear(&manifest); | |
| 272 | createFlag = 0; | 243 | createFlag = 0; | |
| 273 | } | 244 | } | |
| 274 | db_finalize(&q); | 245 | db_finalize(&q); | |
| 344 hidden lines | ||||
| 619 | void tkttimeline_page(void){ | 590 | void tkttimeline_page(void){ | |
| 620 | Stmt q; | 591 | Stmt q; | |
| 621 | char *zTitle; | 592 | char *zTitle; | |
| 622 | char *zSQL; | 593 | char *zSQL; | |
| 623 | const char *zUuid; | 594 | const char *zUuid; | |
| > | 595 | char *zFullUuid; | ||
| 624 | int tagid; | 596 | int tagid; | |
| > | 597 | char zGlobPattern[50]; | ||
| 625 | 598 | |||
| 626 | login_check_credentials(); | 599 | login_check_credentials(); | |
| 627 | if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; } | 600 | if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; } | |
| 628 | zUuid = PD("name",""); | 601 | zUuid = PD("name",""); | |
| 629 | style_submenu_element("History", "History", | 602 | style_submenu_element("History", "History", | |
| 2 hidden lines | ||||
| 632 | "%s/info/%s", g.zTop, zUuid); | 605 | "%s/info/%s", g.zTop, zUuid); | |
| 633 | zTitle = mprintf("Timeline Of Ticket %h", zUuid); | 606 | zTitle = mprintf("Timeline Of Ticket %h", zUuid); | |
| 634 | style_header(zTitle); | 607 | style_header(zTitle); | |
| 635 | free(zTitle); | 608 | free(zTitle); | |
| 636 | 609 | |||
| > | 610 | sqlite3_snprintf(6, zGlobPattern, "%s", zUuid); | ||
| > | 611 | canonical16(zGlobPattern, strlen(zGlobPattern)); | ||
| 637 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); | 612 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); | |
| 638 | if( tagid==0 ){ | 613 | if( tagid==0 ){ | |
| 639 | @ No such ticket: %h(zUuid) | 614 | @ No such ticket: %h(zUuid) | |
| 640 | style_footer(); | 615 | style_footer(); | |
| 641 | return; | 616 | return; | |
| 642 | } | 617 | } | |
| > | 618 | zFullUuid = db_text(0, "SELECT substr(tagname, 5) FROM tag WHERE tagid=%d", | ||
| > | 619 | tagid); | ||
| 643 | zSQL = mprintf("%s AND event.objid IN " | 620 | zSQL = mprintf("%s AND event.objid IN " | |
| 644 | " (SELECT rid FROM tagxref WHERE tagid=%d) " | | | 621 | " (SELECT rid FROM tagxref WHERE tagid=%d UNION" |
| | | 622 | " SELECT srcid FROM backlink WHERE target GLOB '%.4s*' " | ||
| | | 623 | "AND '%s' GLOB (target||'*')) " | ||
| 645 | "ORDER BY mtime DESC", | 624 | "ORDER BY mtime DESC", | |
| 646 | timeline_query_for_www(), tagid); | | | 625 | timeline_query_for_www(), tagid, zFullUuid, zFullUuid); |
| 647 | db_prepare(&q, zSQL); | 626 | db_prepare(&q, zSQL); | |
| 648 | free(zSQL); | 627 | free(zSQL); | |
| 649 | www_print_timeline(&q, TIMELINE_ARTID, 0); | 628 | www_print_timeline(&q, TIMELINE_ARTID, 0); | |
| 650 | db_finalize(&q); | 629 | db_finalize(&q); | |
| 651 | style_footer(); | 630 | style_footer(); | |
| 98 hidden lines | ||||
| 750 | } | 729 | } | |
| 751 | blob_reset(&val); | 730 | blob_reset(&val); | |
| 752 | } | 731 | } | |
| 753 | @ </ol> | 732 | @ </ol> | |
| 754 | } | 733 | } | |