Add more Db support for cached maps

Fix some SQL syntax with map entries
Add Db function to determine the hostname of a map from its ID
Add Db function to organize an array of nodes by their parents
Add a SourceId field to Node