Fossil SCM

Fixed /json/timeline/ticket to work around (what appear to be) attachment(?) artifacts which end up in its query results.

stephan 2012-03-16 12:41 trunk
Commit ac6366218035ed62254c8d458f30801273e5d4fc
1 file changed +23 -11
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -617,26 +617,38 @@
617617
while( (SQLITE_ROW == db_step(&q) )){
618618
/* convert each row into a JSON object...*/
619619
int rc;
620620
int const rid = db_column_int(&q,0);
621621
Manifest * pMan = NULL;
622
- cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
623
- cson_object * row = cson_value_get_object(rowV);
622
+ cson_value * rowV;
623
+ cson_object * row;
624
+ /*printf("rid=%d\n",rid);*/
625
+ pMan = manifest_get(rid, CFTYPE_TICKET);
626
+ if(!pMan){
627
+ /* this might be an attachment? i'm seeing this with
628
+ rid 15380, uuid [1292fef05f2472108].
629
+
630
+ /json/artifact/1292fef05f2472108 returns not-found,
631
+ probably because we haven't added artifact/ticket
632
+ yet(?).
633
+ */
634
+ continue;
635
+ }
636
+
637
+ rowV = cson_sqlite3_row_to_object(q.pStmt);
638
+ row = cson_value_get_object(rowV);
624639
if(!row){
640
+ manifest_destroy(pMan);
625641
json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
626642
"Could not convert at least one timeline result row to JSON." );
627643
continue;
628644
}
629
- pMan = manifest_get(rid, CFTYPE_TICKET);
630
- assert( pMan && "Manifest is NULL!?!" );
631
- if( pMan ){
632
- /* FIXME: certainly there's a more efficient way for use to get
633
- the ticket UUIDs?
634
- */
635
- cson_object_set(row,"ticketUuid",json_new_string(pMan->zTicketUuid));
636
- manifest_destroy(pMan);
637
- }
645
+ /* FIXME: certainly there's a more efficient way for use to get
646
+ the ticket UUIDs?
647
+ */
648
+ cson_object_set(row,"ticketUuid",json_new_string(pMan->zTicketUuid));
649
+ manifest_destroy(pMan);
638650
rc = cson_array_append( list, rowV );
639651
if( 0 != rc ){
640652
cson_value_free(rowV);
641653
g.json.resultCode = (cson_rc.AllocError==rc)
642654
? FSL_JSON_E_ALLOC
643655
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -617,26 +617,38 @@
617 while( (SQLITE_ROW == db_step(&q) )){
618 /* convert each row into a JSON object...*/
619 int rc;
620 int const rid = db_column_int(&q,0);
621 Manifest * pMan = NULL;
622 cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
623 cson_object * row = cson_value_get_object(rowV);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624 if(!row){
 
625 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
626 "Could not convert at least one timeline result row to JSON." );
627 continue;
628 }
629 pMan = manifest_get(rid, CFTYPE_TICKET);
630 assert( pMan && "Manifest is NULL!?!" );
631 if( pMan ){
632 /* FIXME: certainly there's a more efficient way for use to get
633 the ticket UUIDs?
634 */
635 cson_object_set(row,"ticketUuid",json_new_string(pMan->zTicketUuid));
636 manifest_destroy(pMan);
637 }
638 rc = cson_array_append( list, rowV );
639 if( 0 != rc ){
640 cson_value_free(rowV);
641 g.json.resultCode = (cson_rc.AllocError==rc)
642 ? FSL_JSON_E_ALLOC
643
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -617,26 +617,38 @@
617 while( (SQLITE_ROW == db_step(&q) )){
618 /* convert each row into a JSON object...*/
619 int rc;
620 int const rid = db_column_int(&q,0);
621 Manifest * pMan = NULL;
622 cson_value * rowV;
623 cson_object * row;
624 /*printf("rid=%d\n",rid);*/
625 pMan = manifest_get(rid, CFTYPE_TICKET);
626 if(!pMan){
627 /* this might be an attachment? i'm seeing this with
628 rid 15380, uuid [1292fef05f2472108].
629
630 /json/artifact/1292fef05f2472108 returns not-found,
631 probably because we haven't added artifact/ticket
632 yet(?).
633 */
634 continue;
635 }
636
637 rowV = cson_sqlite3_row_to_object(q.pStmt);
638 row = cson_value_get_object(rowV);
639 if(!row){
640 manifest_destroy(pMan);
641 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
642 "Could not convert at least one timeline result row to JSON." );
643 continue;
644 }
645 /* FIXME: certainly there's a more efficient way for use to get
646 the ticket UUIDs?
647 */
648 cson_object_set(row,"ticketUuid",json_new_string(pMan->zTicketUuid));
649 manifest_destroy(pMan);
 
 
 
 
650 rc = cson_array_append( list, rowV );
651 if( 0 != rc ){
652 cson_value_free(rowV);
653 g.json.resultCode = (cson_rc.AllocError==rc)
654 ? FSL_JSON_E_ALLOC
655

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button