static int CC order_column ( const BSTNode *item, const BSTNode *n ) { const SColumnBestFit *a = ( const SColumnBestFit* ) item; const SColumnBestFit *b = ( const SColumnBestFit* ) n; if ( a -> distance < b -> distance ) return -1; if ( a -> distance > b -> distance ) return 1; return VCtxIdCmp ( & a -> scol -> cid, & b -> scol -> cid ); }
/* Sort * compares by ( name, type ) pair */ int CC VColumnRefSort ( const BSTNode *item, const BSTNode *n ) { const VColumnRef *a = ( const VColumnRef* ) item; const VColumnRef *b = ( const VColumnRef* ) n; /* sorted first by name - case sensitive ASCII alphabetically */ int diff = StringCompare ( & a -> name, & b -> name ); if ( diff != 0 ) return diff; /* sort by cid */ return VCtxIdCmp ( & a -> cid, & b -> cid ); }