merge MMcM: Fix issues with codepoints >= U+10000

Merge pull request #1049 from MMcM/sql-layer/varchar-unicode-surrogates
https://github.com/FoundationDB/sql-layer/pull/1049
merge MMcM: Couple problems with handling of top-level VALUES

Merge pull request #1050 from MMcM/sql-layer/sql-top-level-values-types
https://github.com/FoundationDB/sql-layer/pull/1050
Remove old types code and associated confused comment.
Add a new test for various conversions at the script boundary.
Add casting of output values, too.