Hi all, I did some more work on mod_xml_odbc, there is no more static xml layout in the module itself. The module is still buggy and not fully functional, but the idea is there.. It's perhaps easiest to look at the configuration file to see how it works:
http://fisheye.freeswitch.org/browse/FreeSWITCH/scripts/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml?r=13885 Whenever the directory is searched, the module actually makes a copy of the template that is pointed to from given binding. The idea is that all tags in the template are copied *except* special case <xml-odbc-do> which can trigger things like 'query' or 'break-to'. Right now, in mod_xml_odbc.c http://fisheye.freeswitch.org/browse/FreeSWITCH/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c?r=13885 at line 250, I create a new switch_hash_t *hash. All headers (key/value pairs) from given switch_event_t *params are copied in it, after that hash is passed on through all functions that need these values. In another function xml_odbc_render_tag, at lines 176 and 206, I want to use these key/pairs from *hash to auto_expand them in a *char. Rupa suggested to use expand instead of %q, which I really like, I think I understand how that works now. There does not seem to be an _expand_ function on switch_hash_t, so using switch_event_t (which has switch_event_expand_headers) for that seems nice. My question is, is it bad behaviour to just pass on *params given to xml_odbc_search (line 238) to my other functions and also add (temporary) headers to it ? Or must I copy all params into a new switch_event_t and use that instead ? Reason for adding key/value pairs to hash (or headers to the event) is that I want to store variables returned by sql select queries in it (function xml_odbc_query_callback, line 137 - not tested yet), so they can be used in expansions later :) I got rid of user_attrs table like swk suggested, it doesn't fit in the way the module works now and this is indeed nicer. The template: http://fisheye.freeswitch.org/browse/FreeSWITCH/scripts/contrib/ledr/mod_xml_odbc/xml_odbc_templates/directory.xml?r=13885 can easily be changed to be fully compatible with swk's sql schema :) Also, what do you think of the direction it's going ? regards, Leon _______________________________________________ Freeswitch-dev mailing list Freeswitch-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org