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
Fetch RawTemplate from Stack, not a query

This will allow a future optimisation to prefetch Stack.raw_template
in a single query.

Change-Id: I24a64d6159342b3232667e499808dc0233c83e1f
Eager-load Stack.raw_template for Stack.load

Whenever a stack is loaded from the database to perform a
parser.Stack.load, the raw_template should be prefetched to
avoid an extra sql query being performed.

However there are many calls to db_api.stack_get which do not need
to access Stack.raw_template, so the default behaviour is to
lazy-load it.

This change reduces the queries for a Stack.load from 3 to 2, so it
contributes to Related-Bug: #1306743

Change-Id: Ie6dad6ea4b1655a99e97a9ac2b7c00018406cd91
Give resource fakes a string ID

Resource ID values are actually UUIDs but unit tests assume
they are typed as integers.

This change uses the same numbers for test IDs but types them
as strings, which makes the resource fakes closer to real-world
usage.

Change-Id: I8c9d6889db6451019e3986729906b5a37188c133