patch children.default to make more extensible and the error messages more sensible

children.default currently contains a series of if-checks over the value of "db", with different behaviour for each outcome...but no handling for the situation where a db is specified (so, not NULL) but not matched by one of the if checks. This currently leads to a confusing error (object 'out' not found).

This patch replaces the if-checks with a switch to make the set more extensible, and includes within that switch a default option for the situation where a db parameter is !NULL but also not recognised - avoiding the confusing error message and replacing it with "the provided db value was not recognised" (which uses the same syntax as the existing error messages).