2f5148ec4aeeb62f11e3196beaea96f9022ae25d
tdreszer
  Tue Mar 8 16:30:25 2011 -0800
Subtle change to the mdbValLabelSearch() API to put the required val in the pair->name and the optional label in the pair->val.  This helps standardize other code that deals with val/label pairs, and enables using slPairFind().
diff --git src/hg/inc/mdb.h src/hg/inc/mdb.h
index 5766e2f..2324ad0 100644
--- src/hg/inc/mdb.h
+++ src/hg/inc/mdb.h
@@ -358,33 +358,35 @@
 // Search is via mysql, so it's case-insensitive.  Return is sorted on obj.
 
 struct mdbObj *mdbObjRepeatedSearch(struct sqlConnection *conn,struct slPair *varValPairs,boolean tables,boolean files);
 // Search the metaDb table for objs by var,val pairs.  Uses mdbCvSearchMethod() if available.
 // This method will use mdbObjsQueryByVars()
 
 struct slName *mdbObjNameSearch(struct sqlConnection *conn, char *var, char *val, char *op, int limit, boolean tables, boolean files);
 // Search the metaDb table for objs by var and val.  Can restrict by op "is" or "like" and accept (non-zero) limited string size
 // Search is via mysql, so it's case-insensitive.  Return is sorted on obj.
 
 struct slName *mdbValSearch(struct sqlConnection *conn, char *var, int limit, boolean tables, boolean files);
 // Search the metaDb table for vals by var.  Can impose (non-zero) limit on returned string size of val
 // Search is via mysql, so it's case-insensitive.  Return is sorted on val.
 
 struct slPair *mdbValLabelSearch(struct sqlConnection *conn, char *var, int limit, boolean tables, boolean files);
-// Search the metaDb table for vals by var and returns controlled vocabulary (cv) label
-// (if it exists) and val as a pair.  Can impose (non-zero) limit on returned string size of name.
-// Return is case insensitive sorted on name (label or else val).
+// Search the metaDb table for vals by var and returns val (as pair->name) and controlled vocabulary (cv) label
+// (if it exists) (as pair->val).  Can impose (non-zero) limit on returned string size of name.
+// Return is case insensitive sorted on label (cv label or else val).
+#define mdbPairVal(pair) (pair)->name
+#define mdbPairLabel(pair) (pair)->val
 
 struct hash *mdbCvTermHash(char *term);
 // returns a hash of hashes of a term which should be defined in cv.ra
 
 struct hash *mdbCvTermTypeHash();
 // returns a hash of hashes of mdb and controlled vocabulary (cv) term types
 // Those terms should contain label,descrition,searchable,cvDefined,hidden
 
 struct slPair *mdbCvWhiteList(boolean searchTracks, boolean cvLinks);
 // returns the official mdb/controlled vocabulary terms that have been whitelisted for certain uses.
 
 enum mdbCvSearchable
 // metadata Variavble are only certain declared types
     {
     cvsNotSearchable        =0,  // Txt is default