Fetch all db resources in one query

Instead of calling resource_get_by_name_and_stack once for every
resource in the stack, db_api.resource_get_all_by_stack is called
only once for all resources.

This reduces the number of sql queries during a describe_stack_resource
call to 3:
1. load the stack
2. load the template
3. load the resources

This is a big improvement over the start of this patch series, which
is 2 queries plus:
* 1 per resource in the stack
* 1 per access to a resource metadata attribute
* 1 per access to a resource data value

There is probably still potential to reduce queries from 3, but this
may well be a fix for
Partial-Bug: 1306743

Change-Id: I80be5d3de8744813d974f2e9860c148ad258f385