$ select no_hits,term,sprintf('http://google.com?q=%s',replace(queryterm,' ','+')) as url from queries;
$ select event,sprintf("%.2g",probability) as prob from event_probs;
$ select sprintf('<td color="%s">%s</td>',color,content) as td_cell from cells;
I considered a plperl function to do this, but plperl can't take anyarray and that means that I'd have to resort to ugliness like coding for specific numbers of args or encoding args them within in a single string... ick!
Is there a way to get more flexible formatting as in these examples within a backend query, even if not with sprintf per se?
Thanks,
Reece
-- Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0 |