Arjun found the issue on this one:
I needed the "-local" switch for db_multirow, which causes the variables defined by the query to be set locally.
The -local switch is not documented on the api documentation or on the developers guide. I'm changing that right now 😊