Fossil

Check-in [7136ff4c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bug fixes in the TICKETCHNG update mechanism.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ticket-enhancements
Files: files | file ages | folders
SHA1: 7136ff4c65754f081adc86139ae68c5569183c5d
User & Date: drh 2012-11-24 23:54:08
Context
2012-11-25
11:16
Use binary mode for CGI trace files. Make CGI trace cross-platform. check-in: 6a8084ab user: drh tags: ticket-enhancements
02:57
Use binary mode for CGI related trace files. Closed-Leaf check-in: 95f02a57 user: mistachkin tags: cgiTraceBinary
2012-11-24
23:54
Bug fixes in the TICKETCHNG update mechanism. check-in: 7136ff4c user: drh tags: ticket-enhancements
23:07
When --httptrace is used with "fossil ui" or "fossil server", create log files containing the text of each HTTP request. check-in: 6f3d328f user: drh tags: ticket-enhancements
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/tkt.c.

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
214
215
216
217
218
219
220

221
222

223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

240



241
242
243
244
245
246
247
...
506
507
508
509
510
511
512

513
514
515
516
517
518
519
520
**
** Return the new rowid of the TICKET table entry.
*/
static int ticket_insert(const Manifest *p, int rid, int tktid){
  Blob sql1, sql2, sql3;
  Stmt q;
  int i, j;
  const char *zSep = "(";

  if( tktid==0 ){
    db_multi_exec("INSERT INTO ticket(tkt_uuid, tkt_mtime) "
                  "VALUES(%Q, 0)", p->zTicketUuid);
    tktid = db_last_insert_rowid();
  }
  blob_zero(&sql1);
................................................................................
      if( (j = fieldId(zName))<0 ) continue;
      if( aField[j].mUsed & USEDBY_TICKET ){
        blob_appendf(&sql1,", %s=coalesce(%s,'') || %Q",
                     zName, zName, p->aField[i].zValue);
      }
    }else{
      if( (j = fieldId(zName))<0 ) continue;

      blob_appendf(&sql1,", %s=%Q", zName, p->aField[i].zValue);
    }

    if( aField[j].mUsed & USEDBY_TICKETCHNG ){
      blob_appendf(&sql2, "%s%s", zSep, zName);
      blob_appendf(&sql3, "%s%Q", p->aField[i].zValue);
      zSep = ",";
    }
    if( rid>0 ){
      wiki_extract_links(p->aField[i].zValue, rid, 1, p->rDate, i==0, 0);
    }
  }
  blob_appendf(&sql1, " WHERE tkt_id=%d", tktid);
  db_prepare(&q, "%s", blob_str(&sql1));
  db_bind_double(&q, ":mtime", p->rDate);
  db_step(&q);
  db_finalize(&q);
  blob_reset(&sql1);
  if( blob_size(&sql2)>0 ){
    db_multi_exec("INSERT INTO ticketchng %s) VALUES %s)",

                  blob_str(&sql2), blob_str(&sql3));



  }
  blob_reset(&sql2);
  blob_reset(&sql3);
  return tktid;
}

/*
................................................................................
  for(i=0; i<nField; i++){
    const char *zValue;
    int nValue;
    if( aField[i].zAppend ) continue;
    zValue = Th_Fetch(aField[i].zName, &nValue);
    if( zValue ){
      while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }

      if( memcmp(zValue, aField[i].zValue, nValue)!=0
       || strlen(aField[i].zValue)!=nValue
      ){
        if( memcmp(aField[i].zName, "private_", 8)==0 ){
          zValue = db_conceal(zValue, nValue);
          blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue);
        }else{
          blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue);







<







 







>
|
|
>

|
|
<












|
>
|
>
>
>







 







>
|







192
193
194
195
196
197
198

199
200
201
202
203
204
205
...
213
214
215
216
217
218
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
**
** Return the new rowid of the TICKET table entry.
*/
static int ticket_insert(const Manifest *p, int rid, int tktid){
  Blob sql1, sql2, sql3;
  Stmt q;
  int i, j;


  if( tktid==0 ){
    db_multi_exec("INSERT INTO ticket(tkt_uuid, tkt_mtime) "
                  "VALUES(%Q, 0)", p->zTicketUuid);
    tktid = db_last_insert_rowid();
  }
  blob_zero(&sql1);
................................................................................
      if( (j = fieldId(zName))<0 ) continue;
      if( aField[j].mUsed & USEDBY_TICKET ){
        blob_appendf(&sql1,", %s=coalesce(%s,'') || %Q",
                     zName, zName, p->aField[i].zValue);
      }
    }else{
      if( (j = fieldId(zName))<0 ) continue;
      if( aField[j].mUsed & USEDBY_TICKET ){
        blob_appendf(&sql1,", %s=%Q", zName, p->aField[i].zValue);
      }
    }
    if( aField[j].mUsed & USEDBY_TICKETCHNG ){
      blob_appendf(&sql2, ",%s", zName);
      blob_appendf(&sql3, ",%Q", p->aField[i].zValue);

    }
    if( rid>0 ){
      wiki_extract_links(p->aField[i].zValue, rid, 1, p->rDate, i==0, 0);
    }
  }
  blob_appendf(&sql1, " WHERE tkt_id=%d", tktid);
  db_prepare(&q, "%s", blob_str(&sql1));
  db_bind_double(&q, ":mtime", p->rDate);
  db_step(&q);
  db_finalize(&q);
  blob_reset(&sql1);
  if( blob_size(&sql2)>0 ){
    db_prepare(&q, "INSERT INTO ticketchng(tkt_id,tkt_mtime%s)"
                   "VALUES(%d,:mtime%s)",
                  blob_str(&sql2), tktid, blob_str(&sql3));
    db_bind_double(&q, ":mtime", p->rDate);
    db_step(&q);
    db_finalize(&q);
  }
  blob_reset(&sql2);
  blob_reset(&sql3);
  return tktid;
}

/*
................................................................................
  for(i=0; i<nField; i++){
    const char *zValue;
    int nValue;
    if( aField[i].zAppend ) continue;
    zValue = Th_Fetch(aField[i].zName, &nValue);
    if( zValue ){
      while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; }
      if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0)
       || memcmp(zValue, aField[i].zValue, nValue)!=0
       || strlen(aField[i].zValue)!=nValue
      ){
        if( memcmp(aField[i].zName, "private_", 8)==0 ){
          zValue = db_conceal(zValue, nValue);
          blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue);
        }else{
          blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue);