It looks like you have an old version of the template::query proc. Have you done a cvs update lately?
Also, I just made a slight change to the wimpypoint presentation regarding the porting template db queries. If a db call is made from within a proc, you need to make sure the proc is declared with ad_proc, or the query dispatcher won't work correctly.
This advice applies to any proc that uses the standard db api as well, but the templating queries seem to occur quite frequently in procs that were not declared using ad_proc.