Fossil

Check-in [c685a35eb0]
Login

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

Overview
Comment:Added name_to_uuid2()
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c685a35eb08a1c4676df34018fc1f1f75804bf58
User & Date: stephan 2012-03-18 02:45:59.302
Context
2012-03-18
02:46
Added uuid=... option to the as-yet-undocumented /json/finfo. check-in: 6472199167 user: stephan tags: trunk
02:45
Added name_to_uuid2() check-in: c685a35eb0 user: stephan tags: trunk
02:15
Removed the special-cased addition of g.zExtra==parameter named "name" when running in JSON mode because it causes no end of grief in several JSON handlers and none of the handlers rely on that handling. check-in: ccd6c879b4 user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/name.c.
263
264
265
266
267
268
269




















270
271
272
273
274
275
276
    return 1;
  }else{
    blob_reset(pName);
    db_blob(pName, "SELECT uuid FROM blob WHERE rid=%d", rid);
    return 0;
  }
}





















/*
** COMMAND:  test-name-to-id
**
** Convert a name to a full artifact ID.
*/
void test_name_to_id(void){







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
    return 1;
  }else{
    blob_reset(pName);
    db_blob(pName, "SELECT uuid FROM blob WHERE rid=%d", rid);
    return 0;
  }
}

/*
** This routine is similar to name_to_uuid() except in the form it
** takes its parameters and returns its value, and in that it does not
** treat errors as fatal. zName must be a UUID, as described for
** name_to_uuid(). zType is also as described for that function. If
** zName does not resolve, 0 is returned. If it is ambiguous, a
** negative value is returned. On success the rid is returned and
** pUuid (if it is not NULL) is set to the a newly-allocated string,
** the full UUID, which must eventually be free()d by the caller.
*/
int name_to_uuid2(char const *zName, const char *zType, char **pUuid){
  int rid = symbolic_name_to_rid(zName, zType);
  if((rid>0) && pUuid){
    *pUuid = db_text(NULL, "SELECT uuid FROM blob WHERE rid=%d", rid);
  }
  return rid;
}



/*
** COMMAND:  test-name-to-id
**
** Convert a name to a full artifact ID.
*/
void test_name_to_id(void){