** Return as follows:
** 0 Name is not a tag
** 1 A single UUID was found
** 2 More than one UUID was found, so this is presumably a
** propagating tag. The return UUID is the most recent,
** which is most likely to be the one wanted.
*/
int sym_tag_to_uuid(const char *pName, Blob *pUuid){
Stmt q;
int count = 0;
db_prepare(&q,
"SELECT (SELECT uuid FROM blob WHERE rid=objid)"
" FROM tagxref JOIN event ON rid=objid"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname='sym-'||%Q)"
" AND tagtype>0"
" AND value IS NULL"
" ORDER BY event.mtime DESC",
pName
);
blob_zero(pUuid);
while( db_step(&q)==SQLITE_ROW ){
count++;
if(count>1){
break;
}
db_column_blob(&q, 0, pUuid);
}
db_finalize(&q);
return count;
}
/*
** COMMAND: test-name-to-uuid
**
** Convert a name to a full UUID.
*/