Unless I am mistaken, this implements the same functionality as the
pipemap table. It queries tables in sequence, not in parallel.

        Wietse

+static const char *dict_join_lookup(DICT *dict, const char *query)
+{
+    const char myname[] = "dict_join_lookup";
+    DICT_JOIN *dict_join = (DICT_JOIN *) dict;
+    DICT   *map;
+    char  **cpp;
+    char   *dict_type_name;
+    const char *result = 0;
+
+    vstring_strcpy(dict_join->qr_buf, query);
+    for (cpp = dict_join->map_join->argv; (dict_type_name = *cpp) != 0; cpp++) 
{
+       if ((map = dict_handle(dict_type_name)) == 0)
+           msg_panic("%s: dictionary \"%s\" not found", myname, 
dict_type_name);
+       if ((result = dict_get(map, STR(dict_join->qr_buf))) == 0)
+           DICT_ERR_VAL_RETURN(dict, map->error, result);
+       vstring_strcpy(dict_join->qr_buf, result);
+    }
+    DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, STR(dict_join->qr_buf));
+}

Reply via email to