911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
|
** Returns tagxref.rowid if the given blob.rid has a tagxref.rid entry
** an active (non-cancelled) tag matching the given rid and tag name
** string, else returns 0. Note that this function does not
** distinguish between a non-existent tag and a cancelled tag.
*/
int rid_has_active_tag_name(int rid, const char *zTagName){
static Stmt q = empty_Stmt_m;
int rc = 0;
assert( 0 != zTagName );
if( !q.pStmt ){
db_static_prepare(&q,
"SELECT tagxref.rowid FROM tagxref, tag"
" WHERE tagxref.rid=$rid AND tagtype>0 "
" AND tag.tagname=$tagname"
" AND tagxref.tagid=tag.tagid"
);
}
db_bind_int(&q, "$rid", rid);
db_bind_text(&q, "$tagname", zTagName);
if( SQLITE_ROW==db_step(&q) ){
rc = db_column_int(&q, 0);
}
db_reset(&q);
return rc;
}
|
|
|
|
>
|
<
|
<
<
|
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
|
** Returns tagxref.rowid if the given blob.rid has a tagxref.rid entry
** an active (non-cancelled) tag matching the given rid and tag name
** string, else returns 0. Note that this function does not
** distinguish between a non-existent tag and a cancelled tag.
*/
int rid_has_active_tag_name(int rid, const char *zTagName){
static Stmt q = empty_Stmt_m;
int rc;
assert( 0 != zTagName );
if( !q.pStmt ){
db_static_prepare(&q,
"SELECT x.rowid FROM tagxref x, tag t"
" WHERE x.rid=$rid AND x.tagtype>0 "
" AND x.tagid=t.tagid"
" AND t.tagname=$tagname"
);
}
db_bind_int(&q, "$rid", rid);
db_bind_text(&q, "$tagname", zTagName);
rc = (SQLITE_ROW==db_step(&q)) ? db_column_int(&q, 0) : 0;
db_reset(&q);
return rc;
}
|