Fossil

Changes On Branch tkt-ucard
Login

Changes On Branch tkt-ucard

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

Changes In Branch tkt-ucard Excluding Merge-Ins

This is equivalent to a diff from f905bd0d to 6d95ae4f

2022-05-13
23:35
If TICKETCHNG table has TKT_USER column then make the values in that column match to the corresponding U-cards. Add TKT_USER to the default schema. See forum thread 5593538afb77 for rationale. ... (check-in: cf00d07c user: george tags: trunk)
2022-05-08
20:40
Rename proposed column to tkt_user which seems more natural. Amend default schema to create this column (and also drop a nearby comment). Add a tiny optimization to getAllTicketFields(). ... (Closed-Leaf check-in: 6d95ae4f user: george tags: tkt-ucard)
2022-05-03
16:10
Update the built-in SQLite to the latest 3.39.0 alpha which includes the latest bug fixes, and especially the fix for the infinite loop when the Bloom filter pull-down optimization encounters a NULL key. ... (check-in: b2cb7bdb user: drh tags: trunk)
2022-05-01
21:00
Add support for optional tkt_ucard column of the TICKETCHNG table. If this column is present then its value is populated from the U-card of the corresponding artifact. ... (check-in: d681e1dc user: george tags: tkt-ucard)
20:53
Minor code clean-up inside of ticket_insert() function. ... (check-in: 3e4ba24e user: george tags: tkt-ucard)
2022-04-28
14:25
attempt to fix issue where the remote-url saved is overwritten by the proxy url. (issue introduced by checkin [c129f29566439e5c]) ... (check-in: 83ffea65 user: mgagnon tags: fix_remote_url_overwrite_with_proxy)
2022-04-27
15:55
This is a graph layout improvement experiment. In this version of Fossil, when there are multiple merge lines that go off the bottom of the page, they all use the same rail, rather than using separate rails for each parent node. This code is initially parked on a branch for evaluation. ... (Leaf check-in: 65c21819 user: drh tags: off-page-merge-single-rail)
12:11
Update the built-in SQLite to the latest trunk version which includes all of the fixes that went into version 3.38.3. ... (check-in: f905bd0d user: drh tags: trunk)
2022-04-26
14:27
Fix a few **unused-but-set-variable** warnings. (reported by recent clang on MacOS at least). Also fix a **warn_unused_result** warning when calling nice() (gcc 7.5.0 on Ubuntu-18.04 and gcc 9.3.0 on Ubuntu-20.04) ... (check-in: 74250821 user: mgagnon tags: trunk)

Changes to src/schema.c.

456
457
458
459
460
461
462

463
464
465
466
467
468
469
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470







+







@   comment TEXT
@ );
@ CREATE TABLE ticketchng(
@   -- Do not change any column that begins with tkt_
@   tkt_id INTEGER REFERENCES ticket,
@   tkt_rid INTEGER REFERENCES blob,
@   tkt_mtime DATE,
@   tkt_user TEXT,
@   -- Add as many fields as required below this line
@   login TEXT,
@   username TEXT,
@   mimetype TEXT,
@   icomment TEXT
@ );
@ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);

Changes to src/tkt.c.

21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51







-
+















+







#include "config.h"
#include "tkt.h"
#include <assert.h>

/*
** The list of database user-defined fields in the TICKET table.
** The real table also contains some addition fields for internal
** used.  The internal-use fields begin with "tkt_".
** use.  The internal-use fields begin with "tkt_".
*/
static int nField = 0;
static struct tktFieldInfo {
  char *zName;             /* Name of the database field */
  char *zValue;            /* Value to store */
  char *zAppend;           /* Value to append */
  unsigned mUsed;          /* 01: TICKET  02: TICKETCHNG */
} *aField;
#define USEDBY_TICKET      01
#define USEDBY_TICKETCHNG  02
#define USEDBY_BOTH        03
static u8 haveTicket = 0;        /* True if the TICKET table exists */
static u8 haveTicketCTime = 0;   /* True if TICKET.TKT_CTIME exists */
static u8 haveTicketChng = 0;    /* True if the TICKETCHNG table exists */
static u8 haveTicketChngRid = 0; /* True if TICKETCHNG.TKT_RID exists */
static u8 haveTicketChngUser = 0;/* True if TICKETCHNG.TKT_USER exists */

/*
** Compare two entries in aField[] for sorting purposes
*/
static int nameCmpr(const void *a, const void *b){
  return fossil_strcmp(((const struct tktFieldInfo*)a)->zName,
                       ((const struct tktFieldInfo*)b)->zName);
92
93
94
95
96
97
98
99





100
101
102
103
104
105
106
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
110
111







-
+
+
+
+
+







  }
  db_finalize(&q);
  db_prepare(&q, "PRAGMA table_info(ticketchng)");
  while( db_step(&q)==SQLITE_ROW ){
    const char *zFieldName = db_column_text(&q, 1);
    haveTicketChng = 1;
    if( memcmp(zFieldName,"tkt_",4)==0 ){
      if( strcmp(zFieldName,"tkt_rid")==0 ) haveTicketChngRid = 1;
      if( strcmp(zFieldName+4,"rid")==0 ){
        haveTicketChngRid = 1;  /* tkt_rid */
      }else if( strcmp(zFieldName+4,"user")==0 ){
        haveTicketChngUser = 1; /* tkt_user */
      }
      continue;
    }
    if( (i = fieldId(zFieldName))>=0 ){
      aField[i].mUsed |= USEDBY_TICKETCHNG;
      continue;
    }
    if( nField%10==0 ){
188
189
190
191
192
193
194
195



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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
193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
208
209
210
211
212
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







-
+
+
+




















-
-
+
+




-
-
+
-

-
+

-
+



-
-
-
-
-
+







** then it will be the ROWID of an existing TICKET entry.
**
** Parameter rid is the recordID for the ticket artifact in the BLOB table.
**
** Return the new rowid of the TICKET table entry.
*/
static int ticket_insert(const Manifest *p, int rid, int tktid){
  Blob sql1, sql2, sql3;
  Blob sql1; /* update or replace TICKET ... */
  Blob sql2; /* list of TICKETCHNG's fields that are in the manifest */
  Blob sql3; /* list of values which correspond to the previous list */
  Stmt q;
  int i, j;
  char *aUsed;
  const char *zMimetype = 0;

  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);
  blob_zero(&sql2);
  blob_zero(&sql3);
  blob_append_sql(&sql1, "UPDATE OR REPLACE ticket SET tkt_mtime=:mtime");
  if( haveTicketCTime ){
    blob_append_sql(&sql1, ", tkt_ctime=coalesce(tkt_ctime,:mtime)");
  }
  aUsed = fossil_malloc( nField );
  memset(aUsed, 0, nField);
  for(i=0; i<p->nField; i++){
    const char *zName = p->aField[i].zName;
    const char *zBaseName = zName[0]=='+' ? zName+1 : zName;
    const char * const zName = p->aField[i].zName;
    const char * const zBaseName = zName[0]=='+' ? zName+1 : zName;
    j = fieldId(zBaseName);
    if( j<0 ) continue;
    aUsed[j] = 1;
    if( aField[j].mUsed & USEDBY_TICKET ){
      const char *zUsedByName = zName;
      if( zUsedByName[0]=='+' ){
      if( zName[0]=='+' ){
        zUsedByName++;
        blob_append_sql(&sql1,", \"%w\"=coalesce(\"%w\",'') || %Q",
                        zUsedByName, zUsedByName, p->aField[i].zValue);
                        zBaseName, zBaseName, p->aField[i].zValue);
      }else{
        blob_append_sql(&sql1,", \"%w\"=%Q", zUsedByName, p->aField[i].zValue);
        blob_append_sql(&sql1,", \"%w\"=%Q", zBaseName, p->aField[i].zValue);
      }
    }
    if( aField[j].mUsed & USEDBY_TICKETCHNG ){
      const char *zUsedByName = zName;
      if( zUsedByName[0]=='+' ){
        zUsedByName++;
      }
      blob_append_sql(&sql2, ",\"%w\"", zUsedByName);
      blob_append_sql(&sql2, ",\"%w\"", zBaseName);
      blob_append_sql(&sql3, ",%Q", p->aField[i].zValue);
    }
    if( strcmp(zBaseName,"mimetype")==0 ){
      zMimetype = p->aField[i].zValue;
    }
  }
  if( rid>0 ){
252
253
254
255
256
257
258
259

260
261
262

263
264




265
266
267
268
269
270
271
253
254
255
256
257
258
259

260
261
262

263
264
265
266
267
268
269
270
271
272
273
274
275
276







-
+


-
+


+
+
+
+







  }
  blob_append_sql(&sql1, " WHERE tkt_id=%d", tktid);
  db_prepare(&q, "%s", blob_sql_text(&sql1));
  db_bind_double(&q, ":mtime", p->rDate);
  db_step(&q);
  db_finalize(&q);
  blob_reset(&sql1);
  if( blob_size(&sql2)>0 || haveTicketChngRid ){
  if( blob_size(&sql2)>0 || haveTicketChngRid || haveTicketChngUser ){
    int fromTkt = 0;
    if( haveTicketChngRid ){
      blob_append(&sql2, ",tkt_rid", -1);
      blob_append_literal(&sql2, ",tkt_rid");
      blob_append_sql(&sql3, ",%d", rid);
    }
    if( haveTicketChngUser && p->zUser ){
      blob_append_literal(&sql2, ",tkt_user");
      blob_append_sql(&sql3, ",%Q", p->zUser);
    }
    for(i=0; i<nField; i++){
      if( aUsed[i]==0
       && (aField[i].mUsed & USEDBY_BOTH)==USEDBY_BOTH
      ){
        const char *z = aField[i].zName;
        if( z[0]=='+' ) z++;
        fromTkt = 1;

Changes to src/tktsetup.c.

84
85
86
87
88
89
90

91
92
93
94
95
96
97
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98







+







@   comment TEXT
@ );
@ CREATE TABLE ticketchng(
@   -- Do not change any column that begins with tkt_
@   tkt_id INTEGER REFERENCES ticket,
@   tkt_rid INTEGER REFERENCES blob,
@   tkt_mtime DATE,
@   tkt_user TEXT,
@   -- Add as many fields as required below this line
@   login TEXT,
@   username TEXT,
@   mimetype TEXT,
@   icomment TEXT
@ );
@ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);