140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
}
/*
** Insert a tag into the database.
*/
void tag_insert(
const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
int tagtype, /* 0:cancel 1:singleton 2:propagated */
const char *zValue, /* Value if the tag is really a property */
int srcId, /* Artifact that contains this tag */
double mtime, /* Timestamp. Use default if <=0.0 */
int rid /* Artifact to which the tag is to attached */
){
Stmt s;
const char *zCol;
|
|
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
}
/*
** Insert a tag into the database.
*/
void tag_insert(
const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
int tagtype, /* 0:cancel 1:singleton 2:propagated -1:erase */
const char *zValue, /* Value if the tag is really a property */
int srcId, /* Artifact that contains this tag */
double mtime, /* Timestamp. Use default if <=0.0 */
int rid /* Artifact to which the tag is to attached */
){
Stmt s;
const char *zCol;
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
" AND mtime>=:mtime",
tagid, rid
);
db_bind_double(&s, ":mtime", mtime);
rc = db_step(&s);
db_finalize(&s);
if( rc==SQLITE_ROW ){
/* Another entry this is more recent already exists. Do nothing */
return;
}
db_prepare(&s,
"REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)"
" VALUES(%d,%d,%d,%Q,:mtime,%d)",
tagid, tagtype, srcId, zValue, rid
);
db_bind_double(&s, ":mtime", mtime);
|
|
>
>
>
>
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
" AND mtime>=:mtime",
tagid, rid
);
db_bind_double(&s, ":mtime", mtime);
rc = db_step(&s);
db_finalize(&s);
if( rc==SQLITE_ROW ){
/* Another entry that is more recent already exists. Do nothing */
return;
}
if( tagtype<0 ){
return;
/* TBD: erase tags */
}
db_prepare(&s,
"REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)"
" VALUES(%d,%d,%d,%Q,:mtime,%d)",
tagid, tagtype, srcId, zValue, rid
);
db_bind_double(&s, ":mtime", mtime);
|