Diff
Not logged in

Differences From:

File src/tkt.c part of check-in [0be54823ba] - Add defenses against cross-site request forgery attacks. by drh on 2008-10-18 12:55:44. [view]

To:

File src/tkt.c part of check-in [f0c8693845] - More improvements to the timeline display of ticket changes. by drh on 2008-10-20 06:41:12. [view]

@@ -187,19 +187,24 @@
 ** in the control file given in p.  Attempt to create the appropriate
 ** TICKET table entry if createFlag is true.  If createFlag is false,
 ** that means we already know the entry exists and so we can save the
 ** work of trying to create it.
+**
+** Return TRUE if a new TICKET entry was created and FALSE if an
+** existing entry was revised.
 */
-void ticket_insert(Manifest *p, int createFlag, int checkTime){
+int ticket_insert(Manifest *p, int createFlag, int checkTime){
   Blob sql;
   Stmt q;
   int i;
   const char *zSep;
+  int rc = 0;
 
   getAllTicketFields();
   if( createFlag ){
     db_multi_exec("INSERT OR IGNORE INTO ticket(tkt_uuid, tkt_mtime) "
                   "VALUES(%Q, 0)", p->zTicketUuid);
+    rc = db_changes();
   }
   blob_zero(&sql);
   blob_appendf(&sql, "UPDATE OR REPLACE ticket SET tkt_mtime=:mtime");
   zSep = "SET";
@@ -230,8 +235,9 @@
     db_multi_exec("INSERT OR IGNORE INTO _pending_ticket "
                   "VALUES(%Q)", p->zTicketUuid);
   }
   blob_reset(&sql);
+  return rc;
 }
 
 /*
 ** Rebuild an entire entry in the TICKET table